File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/test/java/org/json/junit Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -325,4 +325,21 @@ public void testAutoClose(){
325325 assertEquals ("Stream closed" , exception .getMessage ());
326326 }
327327 }
328+
329+ @ Test
330+ public void testInvalidInput_JSONObject_withoutStrictModel_shouldParseInput () {
331+ String input = "{\" invalidInput\" : [],}" ;
332+ JSONTokener tokener = new JSONTokener (input );
333+ Object value = tokener .nextValue ();
334+ assertEquals (new JSONObject (input ).toString (), value .toString ());
335+ }
336+
337+ @ Test
338+ public void testInvalidInput_JSONArray_withoutStrictModel_shouldParseInput () {
339+ String input = "[\" invalidInput\" ,]" ;
340+ JSONTokener tokener = new JSONTokener (input );
341+ Object value = tokener .nextValue ();
342+ assertEquals (new JSONArray (input ).toString (), value .toString ());
343+ }
344+
328345}
You can’t perform that action at this time.
0 commit comments