incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1304461 - /sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
Date Fri, 23 Mar 2012 16:18:32 GMT
Author: justin
Date: Fri Mar 23 16:18:32 2012
New Revision: 1304461

URL: http://svn.apache.org/viewvc?rev=1304461&view=rev
Log:
SLING-2446 - adding more test cases for BigDecimal values (thanks Jeff!)

Modified:
    sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java

Modified: sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java?rev=1304461&r1=1304460&r2=1304461&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
Fri Mar 23 16:18:32 2012
@@ -86,6 +86,7 @@ public class JcrPropertyMapTest extends 
 
         testValue(rootNode, 1.0d, Float.class);
         testValue(rootNode, 1.0d, Double.class);
+        testValue(rootNode, 1.0d, BigDecimal.class);
 
         Calendar cal = Calendar.getInstance();
         testValue(rootNode, cal, Calendar.class);
@@ -105,6 +106,11 @@ public class JcrPropertyMapTest extends 
 
         testValue(rootNode, 1.0d, 10.0f);
         testValue(rootNode, 1.0d, 10.0d);
+        testValue(rootNode, 1.0d, new BigDecimal("1.0"));
+
+        testValue(rootNode, BigDecimal.TEN, 10.0f);
+        testValue(rootNode, BigDecimal.TEN, 10.0d);
+        testValue(rootNode, BigDecimal.TEN, BigDecimal.TEN);
 
         long refTime = 1000l;
         Date refDate = new Date(refTime);
@@ -129,6 +135,7 @@ public class JcrPropertyMapTest extends 
 
         testDefaultValue(rootNode, 10.0f);
         testDefaultValue(rootNode, 10.0d);
+        testDefaultValue(rootNode, new BigDecimal("50.50"));
 
         long refTime = 1000l;
         Date refDate = new Date(refTime);
@@ -146,7 +153,7 @@ public class JcrPropertyMapTest extends 
         ValueMap map = createProperty(rootNode, "Sample Value For Prop");
         Property prop = rootNode.getProperty(PROP_NAME);
 
-        // explicite type
+        // explicit type
         Property result = map.get(PROP_NAME, Property.class);
         assertTrue(prop.isSame(result));
 
@@ -206,6 +213,9 @@ public class JcrPropertyMapTest extends 
         } else if (value instanceof Double && result instanceof Number) {
             assertEquals(((Number) value).doubleValue(), ((Number) result).doubleValue());
 
+        } else if (value instanceof BigDecimal && result instanceof Number) {
+            assertEquals(((BigDecimal) value).doubleValue(), ((Number) result).doubleValue());
+
         } else if (value instanceof Calendar) {
             long resultTime;
             if (result instanceof Date) {



Mime
View raw message