mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
Fail when exceptions are not thrown as expected
The idiom was started in the first few methods, but not continued further down where JSONException was expected. False success may have resulted.
This commit is contained in:
parent
efe33a1e37
commit
e57881f8fa
1 changed files with 4 additions and 0 deletions
|
@ -60,6 +60,7 @@ public class JSONStringerTest {
|
|||
jsonStringer.object().endObject();
|
||||
try {
|
||||
jsonStringer.array();
|
||||
assertTrue("Expected an exception", false);
|
||||
} catch (JSONException e) {
|
||||
assertTrue("Expected an exception message",
|
||||
"Misplaced array.".
|
||||
|
@ -77,6 +78,7 @@ public class JSONStringerTest {
|
|||
jsonStringer.object();
|
||||
try {
|
||||
jsonStringer.endArray();
|
||||
assertTrue("Expected an exception", false);
|
||||
} catch (JSONException e) {
|
||||
assertTrue("Expected an exception message",
|
||||
"Misplaced endArray.".
|
||||
|
@ -94,6 +96,7 @@ public class JSONStringerTest {
|
|||
jsonStringer.array();
|
||||
try {
|
||||
jsonStringer.endObject();
|
||||
assertTrue("Expected an exception", false);
|
||||
} catch (JSONException e) {
|
||||
assertTrue("Expected an exception message",
|
||||
"Misplaced endObject.".
|
||||
|
@ -111,6 +114,7 @@ public class JSONStringerTest {
|
|||
jsonStringer.object().endObject();
|
||||
try {
|
||||
jsonStringer.object();
|
||||
assertTrue("Expected an exception", false);
|
||||
} catch (JSONException e) {
|
||||
assertTrue("Expected an exception message",
|
||||
"Misplaced object.".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue