You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/05/26 13:43:08 UTC
[commons-lang] branch master updated: Increase test coverage of ComparableUtils from 71% to 100% (#898)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new f7c338b0f Increase test coverage of ComparableUtils from 71% to 100% (#898)
f7c338b0f is described below
commit f7c338b0fce67a96831f6d1f6acdada3cc766732
Author: Steve Bosman <st...@opencastsoftware.com>
AuthorDate: Thu May 26 14:43:02 2022 +0100
Increase test coverage of ComparableUtils from 71% to 100% (#898)
---
.../commons/lang3/compare/ComparableUtilsTest.java | 151 +++++++++++++++++++++
1 file changed, 151 insertions(+)
diff --git a/src/test/java/org/apache/commons/lang3/compare/ComparableUtilsTest.java b/src/test/java/org/apache/commons/lang3/compare/ComparableUtilsTest.java
index a55df2d70..600bca71e 100644
--- a/src/test/java/org/apache/commons/lang3/compare/ComparableUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/compare/ComparableUtilsTest.java
@@ -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;