You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2012/08/22 08:59:14 UTC

svn commit: r1375907 - /sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/JSONObjectTest.java

Author: fmeschbe
Date: Wed Aug 22 06:59:14 2012
New Revision: 1375907

URL: http://svn.apache.org/viewvc?rev=1375907&view=rev
Log:
Add test case validating "null" values can be used

Modified:
    sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/JSONObjectTest.java

Modified: sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/JSONObjectTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/JSONObjectTest.java?rev=1375907&r1=1375906&r2=1375907&view=diff
==============================================================================
--- sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/JSONObjectTest.java (original)
+++ sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/JSONObjectTest.java Wed Aug 22 06:59:14 2012
@@ -49,4 +49,12 @@ public class JSONObjectTest extends Test
         }
     }
 
+    public void testNull() throws JSONException {
+        JSONObject obj = new JSONObject();
+        obj.put(KEY, JSONObject.NULL);
+
+        TestCase.assertTrue(obj.has(KEY));
+        TestCase.assertTrue(obj.get(KEY).equals(null));
+        TestCase.assertEquals("{\"" + KEY + "\":null}", obj.toString());
+    }
 }