82 lines
2.3 KiB
Java
82 lines
2.3 KiB
Java
/*
|
|
* Copyright (c) 2024 John Ahlroos
|
|
*
|
|
* Creative Commons Attribution-NoDerivatives 4.0 International Public License
|
|
*
|
|
* By exercising the Licensed Rights (defined below), You accept and agree
|
|
* to be bound by the terms and conditions of this Creative Commons
|
|
* Attribution-NoDerivatives 4.0 International Public License ("Public
|
|
* License"). To the extent this Public License may be interpreted as a
|
|
* contract, You are granted the Licensed Rights in consideration of Your
|
|
* acceptance of these terms and conditions, and the Licensor grants You
|
|
* such rights in consideration of benefits the Licensor receives from
|
|
* making the Licensed Material available under these terms and
|
|
* conditions.
|
|
*
|
|
* Refer to LICENSE file or https://creativecommons.org/licenses/by-nd/4.0 for full license.
|
|
*
|
|
*/
|
|
package com.devsoap.json;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static com.devsoap.json.JsonAssert.assertThat;
|
|
|
|
public class LongAssertionTest {
|
|
|
|
private static final String JSON = """
|
|
{
|
|
"positive": 100000000012,
|
|
"negative": -100000000032,
|
|
"zero": 0
|
|
}
|
|
""";
|
|
|
|
@Test
|
|
public void equals() {
|
|
assertThat(JSON)
|
|
.field("positive")
|
|
.asLong()
|
|
.isEqualTo(100000000012L);
|
|
assertThat(JSON)
|
|
.field("negative")
|
|
.asLong()
|
|
.isEqualTo(-100000000032L);
|
|
assertThat(JSON)
|
|
.field("zero")
|
|
.asLong()
|
|
.isEqualTo(0L);
|
|
}
|
|
|
|
@Test
|
|
public void greaterThan() {
|
|
assertThat(JSON)
|
|
.field("positive")
|
|
.asLong()
|
|
.isGreaterThan(10000);
|
|
assertThat(JSON)
|
|
.field("negative")
|
|
.asLong()
|
|
.isGreaterThan(-100000000052L);
|
|
assertThat(JSON)
|
|
.field("zero")
|
|
.asLong()
|
|
.isGreaterThan(-1);
|
|
}
|
|
|
|
@Test
|
|
public void lessThan() {
|
|
assertThat(JSON)
|
|
.field("positive")
|
|
.asLong()
|
|
.isLessThan(2100000000012L);
|
|
assertThat(JSON)
|
|
.field("negative")
|
|
.asLong()
|
|
.isLessThan(0);
|
|
assertThat(JSON)
|
|
.field("zero")
|
|
.asLong()
|
|
.isLessThan(1);
|
|
}
|
|
} |