mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
New test to verify unclosed array
This commit is contained in:
parent
af3b7dc443
commit
52ecc89702
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user