aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-01 11:55:23 -0400
committerJames Moger <james.moger@gitblit.com>2014-11-03 12:51:16 -0500
commit97b542aa654ccc4eb47b313de9078bdfabbe727b (patch)
treedd97569fc8eaef35a46e7a54d7c9c86bf46213ac /src
parent3e0597adb83904ad1093b23a7b2fa69e6386999b (diff)
downloadiciql-97b542aa654ccc4eb47b313de9078bdfabbe727b.tar.gz
iciql-97b542aa654ccc4eb47b313de9078bdfabbe727b.zip
Relax BigDecimal equivalency checks
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/iciql/test/SamplesTest.java3
-rw-r--r--src/test/java/com/iciql/test/models/SupportedTypes.java6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/test/java/com/iciql/test/SamplesTest.java b/src/test/java/com/iciql/test/SamplesTest.java
index df6d219..dbbf97f 100644
--- a/src/test/java/com/iciql/test/SamplesTest.java
+++ b/src/test/java/com/iciql/test/SamplesTest.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
+import java.text.DecimalFormat;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -214,7 +215,7 @@ public class SamplesTest {
@Override
public String toString() {
- return customerId + ":" + orderId + ":" + total;
+ return customerId + ":" + orderId + ":" + new DecimalFormat("##.00").format(total);
}
}
diff --git a/src/test/java/com/iciql/test/models/SupportedTypes.java b/src/test/java/com/iciql/test/models/SupportedTypes.java
index 489650e..d9a6405 100644
--- a/src/test/java/com/iciql/test/models/SupportedTypes.java
+++ b/src/test/java/com/iciql/test/models/SupportedTypes.java
@@ -19,6 +19,7 @@ package com.iciql.test.models;
import java.io.Serializable;
import java.math.BigDecimal;
+import java.math.MathContext;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Arrays;
@@ -178,7 +179,10 @@ public class SupportedTypes implements Serializable {
same &= same("myLong", myLong.equals(s.myLong));
same &= same("myFloat", IciqlSuite.equivalentTo(myFloat, s.myFloat));
same &= same("myDouble", IciqlSuite.equivalentTo(myDouble, s.myDouble));
- same &= same("myBigDecimal", myBigDecimal.compareTo(s.myBigDecimal) == 0);
+
+ BigDecimal bda = myBigDecimal.round(MathContext.DECIMAL32);
+ BigDecimal bdb = s.myBigDecimal.round(MathContext.DECIMAL32);
+ same &= same("myBigDecimal", bda.compareTo(bdb) == 0);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
same &= same("myUtilDate", df.format(myUtilDate).equals(df.format(s.myUtilDate)));