mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-07 19:14:15 +08:00
New test to verify unclosed array
This commit is contained in:
@@ -79,6 +79,21 @@ public class JSONArrayTest {
|
|||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to create a JSONArray with an unclosed array.
|
||||||
|
* Expects an exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void unclosedArray() {
|
||||||
|
try {
|
||||||
|
assertNull("Should throw an exception", new JSONArray("["));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
assertEquals("Expected an exception message",
|
||||||
|
"A JSONArray text must start with '[' at 0 [character 1 line 1]",
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to create a JSONArray with a string as object that is
|
* Attempt to create a JSONArray with a string as object that is
|
||||||
|
Reference in New Issue
Block a user