1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

New test to verify unclosed array

This commit is contained in:
John J. Aylward 2017-10-30 07:27:42 -04:00
parent af3b7dc443
commit 52ecc89702

View file

@ -79,6 +79,21 @@ public class JSONArrayTest {
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