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:
parent
af3b7dc443
commit
52ecc89702
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue