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
|
@ -80,6 +80,21 @@ public class JSONArrayTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
* not a JSON array doc.
|
* not a JSON array doc.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue