Increase test coverage of ComparableUtils from 71% to 100% (#898)

This commit is contained in:
Steve Bosman 2022-05-26 14:43:02 +01:00 committed by GitHub
parent 3a0ba3c6ea
commit f7c338b0fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 151 additions and 0 deletions

View File

@ -55,6 +55,17 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_false() {
assertFalse(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
@DisplayName("C is 1 (B < A = C)")
@ -72,6 +83,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
@DisplayName("C is 10 (B < A < C)")
@ -89,6 +110,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_true() {
assertTrue(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_true() {
assertTrue(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
BigDecimal b = BigDecimal.ZERO;
@ -117,6 +148,26 @@ public class ComparableUtilsTest {
void lessThanOrEqualTo_returns_false() {
assertFalse(is(a).lessThanOrEqualTo(b));
}
@Test
void static_gt_returns_true() {
assertTrue(ComparableUtils.gt(b).test(a));
}
@Test
void static_ge_returns_true() {
assertTrue(ComparableUtils.ge(b).test(a));
}
@Test
void static_lt_returns_false() {
assertFalse(ComparableUtils.lt(b).test(a));
}
@Test
void static_le_returns_false() {
assertFalse(ComparableUtils.le(b).test(a));
}
}
@DisplayName("B is 1 (B = A)")
@ -138,6 +189,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
@DisplayName("C is 1 (B = A = C)")
@ -155,6 +216,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
@DisplayName("C is 10 (B = A < C)")
@ -172,6 +243,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
BigDecimal b = BigDecimal.ONE;
@ -200,6 +281,26 @@ public class ComparableUtilsTest {
void lessThanOrEqualTo_returns_true() {
assertTrue(is(a).lessThanOrEqualTo(b));
}
@Test
void static_gt_returns_false() {
assertFalse(ComparableUtils.gt(b).test(a));
}
@Test
void static_ge_returns_true() {
assertTrue(ComparableUtils.ge(b).test(a));
}
@Test
void static_lt_returns_false() {
assertFalse(ComparableUtils.lt(b).test(a));
}
@Test
void static_le_returns_true() {
assertTrue(ComparableUtils.le(b).test(a));
}
}
@DisplayName("B is 10 (B > A)")
@ -221,6 +322,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_true() {
assertTrue(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_true() {
assertTrue(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
@DisplayName("C is 1 (B > A = C)")
@ -238,6 +349,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_true() {
assertTrue(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
@DisplayName("C is 10 ([B,C] > A)")
@ -255,6 +376,16 @@ public class ComparableUtilsTest {
void betweenExclusive_returns_false() {
assertFalse(is(a).betweenExclusive(b, c));
}
@Test
void static_between_returns_false() {
assertFalse(ComparableUtils.between(b, c).test(a));
}
@Test
void static_betweenExclusive_returns_false() {
assertFalse(ComparableUtils.betweenExclusive(b, c).test(a));
}
}
BigDecimal b = BigDecimal.TEN;
@ -283,6 +414,26 @@ public class ComparableUtilsTest {
void lessThanOrEqualTo_returns_true() {
assertTrue(is(a).lessThanOrEqualTo(b));
}
@Test
void static_gt_returns_false() {
assertFalse(ComparableUtils.gt(b).test(a));
}
@Test
void static_ge_returns_false() {
assertFalse(ComparableUtils.ge(b).test(a));
}
@Test
void static_lt_returns_true() {
assertTrue(ComparableUtils.lt(b).test(a));
}
@Test
void static_le_returns_true() {
assertTrue(ComparableUtils.le(b).test(a));
}
}
BigDecimal a = BigDecimal.ONE;