Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 441CB9AB7 for ; Fri, 23 Mar 2012 16:18:56 +0000 (UTC) Received: (qmail 4202 invoked by uid 500); 23 Mar 2012 16:18:56 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 4157 invoked by uid 500); 23 Mar 2012 16:18:56 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 4148 invoked by uid 99); 23 Mar 2012 16:18:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 16:18:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 16:18:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BD4EF238897A; Fri, 23 Mar 2012 16:18:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@sling.apache.org From: justin@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120323161832.BD4EF238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) {