mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
Test cases updates for standardized exception messages
This commit is contained in:
parent
6dcd82a72f
commit
fb01575394
3 changed files with 13 additions and 13 deletions
|
@ -346,14 +346,14 @@ public class JSONArrayTest {
|
||||||
assertTrue("expected getDouble to fail", false);
|
assertTrue("expected getDouble to fail", false);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expected an exception message",
|
assertEquals("Expected an exception message",
|
||||||
"JSONArray[4] is not a number.",e.getMessage());
|
"JSONArray[4] is not a double.",e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
jsonArray.getInt(4);
|
jsonArray.getInt(4);
|
||||||
assertTrue("expected getInt to fail", false);
|
assertTrue("expected getInt to fail", false);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expected an exception message",
|
assertEquals("Expected an exception message",
|
||||||
"JSONArray[4] is not a number.",e.getMessage());
|
"JSONArray[4] is not a int.",e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
jsonArray.getJSONArray(4);
|
jsonArray.getJSONArray(4);
|
||||||
|
@ -374,14 +374,14 @@ public class JSONArrayTest {
|
||||||
assertTrue("expected getLong to fail", false);
|
assertTrue("expected getLong to fail", false);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expected an exception message",
|
assertEquals("Expected an exception message",
|
||||||
"JSONArray[4] is not a number.",e.getMessage());
|
"JSONArray[4] is not a long.",e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
jsonArray.getString(5);
|
jsonArray.getString(5);
|
||||||
assertTrue("expected getString to fail", false);
|
assertTrue("expected getString to fail", false);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expected an exception message",
|
assertEquals("Expected an exception message",
|
||||||
"JSONArray[5] not a string.",e.getMessage());
|
"JSONArray[5] is not a String.",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,9 @@ public class JSONMLTest {
|
||||||
JSONML.toString(jsonArray);
|
JSONML.toString(jsonArray);
|
||||||
assertTrue("Expecting an exception", false);
|
assertTrue("Expecting an exception", false);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertTrue("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONArray[0] not a string.".
|
"JSONArray[0] is not a String.",
|
||||||
equals(e.getMessage()));
|
e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1041,7 +1041,7 @@ public class JSONObjectTest {
|
||||||
fail("Expected an exception");
|
fail("Expected an exception");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONObject[\"trueKey\"] not a string.",
|
"JSONObject[\"trueKey\"] is not a string.",
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -1057,7 +1057,7 @@ public class JSONObjectTest {
|
||||||
fail("Expected an exception");
|
fail("Expected an exception");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONObject[\"stringKey\"] is not a number.",
|
"JSONObject[\"stringKey\"] is not a double.",
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -1073,7 +1073,7 @@ public class JSONObjectTest {
|
||||||
fail("Expected an exception");
|
fail("Expected an exception");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONObject[\"stringKey\"] is not a number.",
|
"JSONObject[\"stringKey\"] is not a float.",
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -1089,7 +1089,7 @@ public class JSONObjectTest {
|
||||||
fail("Expected an exception");
|
fail("Expected an exception");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONObject[\"stringKey\"] is not a number.",
|
"JSONObject[\"stringKey\"] is not a int.",
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -1105,7 +1105,7 @@ public class JSONObjectTest {
|
||||||
fail("Expected an exception");
|
fail("Expected an exception");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONObject[\"stringKey\"] is not a number.",
|
"JSONObject[\"stringKey\"] is not a long.",
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -2087,7 +2087,7 @@ public class JSONObjectTest {
|
||||||
fail("Expected an exception");
|
fail("Expected an exception");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
assertEquals("Expecting an exception message",
|
assertEquals("Expecting an exception message",
|
||||||
"JSONObject[myKey] is not a JSONArray.",
|
"JSONObject[\"myKey\"] is not a JSONArray (null).",
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue