Skip to content

Commit dc10ec9

Browse files
committed
add test case for JSONArray
1 parent 45294cb commit dc10ec9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/test/java/org/json/junit/JSONTokenerTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import static org.junit.Assert.assertEquals;
88
import static org.junit.Assert.assertFalse;
9-
import static org.junit.Assert.assertSame;
109
import static org.junit.Assert.assertTrue;
1110
import static org.junit.Assert.fail;
1211

@@ -328,10 +327,18 @@ public void testAutoClose(){
328327
}
329328

330329
@Test
331-
public void testInvalidInput_shouldThrowJSONException() {
330+
public void testInvalidInput_JSONObject_withoutStrictModel_shouldParseInput() {
332331
String input = "{\"invalidInput\": [],}";
333332
JSONTokener tokener = new JSONTokener(input);
334333
Object value = tokener.nextValue();
335334
assertEquals(new JSONObject(input).toString(), value.toString());
336335
}
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+
}
337344
}

0 commit comments

Comments
 (0)