|
18 | 18 |
|
19 | 19 | import java.lang.reflect.Method;
|
20 | 20 | import java.math.BigDecimal;
|
| 21 | +import java.math.BigInteger; |
21 | 22 |
|
22 | 23 | import org.junit.Test;
|
23 | 24 | import org.kie.dmn.feel.lang.FEELProperty;
|
@@ -70,6 +71,22 @@ public void testGetGenericAccessor() throws NoSuchMethodException {
|
70 | 71 | assertThat(EvalHelper.getGenericAccessor(TestPojo.class, "feelPropertyIdentifier")).as("getGenericAccessor should work for methods annotated with '@FEELProperty'.").isEqualTo(expectedAccessor);
|
71 | 72 | }
|
72 | 73 |
|
| 74 | + @Test |
| 75 | + public void testNumericValuesComparative() { |
| 76 | + assertThat(EvalHelper.compare(BigDecimal.valueOf(1), BigDecimal.valueOf(2), null, (l, r) -> l.compareTo(r) < 0)).isTrue(); |
| 77 | + assertThat(EvalHelper.compare(1.0, 2.0, null, (l, r) -> l.compareTo(r) < 0)).isTrue(); |
| 78 | + assertThat(EvalHelper.compare(1, 2, null, (l, r) -> l.compareTo(r) > 0)).isFalse(); |
| 79 | + assertThat(EvalHelper.compare(BigDecimal.valueOf(1), 2, null, (l, r) -> l.compareTo(r) > 0)).isFalse(); |
| 80 | + assertThat(EvalHelper.compare(1, BigDecimal.valueOf(2), null, (l, r) -> l.compareTo(r) < 0)).isTrue(); |
| 81 | + assertThat(EvalHelper.compare(BigDecimal.valueOf(1), 2.3, null, (l, r) -> l.compareTo(r) == 0)).isFalse(); |
| 82 | + assertThat(EvalHelper.compare(1.2, BigDecimal.valueOf(1.2), null, (l, r) -> l.compareTo(r) == 0)).isTrue(); |
| 83 | + assertThat(EvalHelper.compare(BigDecimal.valueOf(1), 0L, null, (l, r) -> l.compareTo(r) > 0)).isTrue(); |
| 84 | + assertThat(EvalHelper.compare(10L, BigDecimal.valueOf(2), null, (l, r) -> l.compareTo(r) < 0)).isFalse(); |
| 85 | + assertThat(EvalHelper.compare(BigInteger.valueOf(1), BigInteger.valueOf(2), null, (l, r) -> l.compareTo(r) == 0)).isFalse(); |
| 86 | + assertThat(EvalHelper.compare(BigInteger.valueOf(1), 2, null, (l, r) -> l.compareTo(r) < 0)).isTrue(); |
| 87 | + assertThat(EvalHelper.compare(BigInteger.valueOf(1), 2.3, null, (l, r) -> l.compareTo(r) == 0)).isFalse(); |
| 88 | + } |
| 89 | + |
73 | 90 | private static class TestPojo {
|
74 | 91 | @FEELProperty("feelPropertyIdentifier")
|
75 | 92 | public String getAProperty() {
|
|
0 commit comments