You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2015/11/06 12:55:16 UTC

svn commit: r1712950 - /sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/util/ValidatorTest.java

Author: sseifert
Date: Fri Nov  6 11:55:16 2015
New Revision: 1712950

URL: http://svn.apache.org/viewvc?rev=1712950&view=rev
Log:
cosmetic: simplify test cases expected to fail (no functional change)

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

Modified: sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/util/ValidatorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/util/ValidatorTest.java?rev=1712950&r1=1712949&r2=1712950&view=diff
==============================================================================
--- sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/util/ValidatorTest.java (original)
+++ sling/trunk/bundles/commons/json/src/test/java/org/apache/sling/commons/json/util/ValidatorTest.java Fri Nov  6 11:55:16 2015
@@ -16,8 +16,6 @@
  */
 package org.apache.sling.commons.json.util;
 
-import static org.junit.Assert.assertTrue;
-
 import org.apache.sling.commons.json.JSONException;
 import org.junit.Test;
 
@@ -45,23 +43,14 @@ public class ValidatorTest {
         Validator.validate("{a:\"you\", b:2, c:true, d: {d:1}, e: []}");
     }
 
-    /**
-     * These tests are supposed to fail!
-     */
-    @Test
-    public void testTrailingChars() {
-        try {
-            Validator.validate("[1,true,\"hallo\",]");
-            assertTrue("Trailing separator should not be allowed.", false);
-        } catch (JSONException e) {
-            // ignore
-        }
-        try {
-            Validator.validate("{a:\"you\", b:2, c:true,}");
-            assertTrue("Trailing separator should not be allowed.", false);
-        } catch (JSONException e) {
-            // ignore
-        }
+    @Test(expected=JSONException.class)
+    public void testTrailingCharsArray() throws JSONException {
+        Validator.validate("[1,true,\"hallo\",]");
+    }
+
+    @Test(expected=JSONException.class)
+    public void testTrailingCharsObject() throws JSONException {
+        Validator.validate("{a:\"you\", b:2, c:true,}");
     }
 
 }