Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cases updates for standardized exception messages #95

Merged
merged 1 commit into from Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/test/java/org/json/junit/JSONArrayTest.java
Expand Up @@ -346,14 +346,14 @@ public void failedGetArrayValues() {
assertTrue("expected getDouble to fail", false);
} catch (JSONException e) {
assertEquals("Expected an exception message",
"JSONArray[4] is not a number.",e.getMessage());
"JSONArray[4] is not a double.",e.getMessage());
}
try {
jsonArray.getInt(4);
assertTrue("expected getInt to fail", false);
} catch (JSONException e) {
assertEquals("Expected an exception message",
"JSONArray[4] is not a number.",e.getMessage());
"JSONArray[4] is not a int.",e.getMessage());
}
try {
jsonArray.getJSONArray(4);
Expand All @@ -374,14 +374,14 @@ public void failedGetArrayValues() {
assertTrue("expected getLong to fail", false);
} catch (JSONException e) {
assertEquals("Expected an exception message",
"JSONArray[4] is not a number.",e.getMessage());
"JSONArray[4] is not a long.",e.getMessage());
}
try {
jsonArray.getString(5);
assertTrue("expected getString to fail", false);
} catch (JSONException e) {
assertEquals("Expected an exception message",
"JSONArray[5] not a string.",e.getMessage());
"JSONArray[5] is not a String.",e.getMessage());
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/json/junit/JSONMLTest.java
Expand Up @@ -133,9 +133,9 @@ public void emptyTagException() {
JSONML.toString(jsonArray);
assertTrue("Expecting an exception", false);
} catch (JSONException e) {
assertTrue("Expecting an exception message",
"JSONArray[0] not a string.".
equals(e.getMessage()));
assertEquals("Expecting an exception message",
"JSONArray[0] is not a String.",
e.getMessage());
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/json/junit/JSONObjectTest.java
Expand Up @@ -1041,7 +1041,7 @@ public void jsonObjectNonAndWrongValues() {
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONObject[\"trueKey\"] not a string.",
"JSONObject[\"trueKey\"] is not a string.",
e.getMessage());
}
try {
Expand All @@ -1057,7 +1057,7 @@ public void jsonObjectNonAndWrongValues() {
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONObject[\"stringKey\"] is not a number.",
"JSONObject[\"stringKey\"] is not a double.",
e.getMessage());
}
try {
Expand All @@ -1073,7 +1073,7 @@ public void jsonObjectNonAndWrongValues() {
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONObject[\"stringKey\"] is not a number.",
"JSONObject[\"stringKey\"] is not a float.",
e.getMessage());
}
try {
Expand All @@ -1089,7 +1089,7 @@ public void jsonObjectNonAndWrongValues() {
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONObject[\"stringKey\"] is not a number.",
"JSONObject[\"stringKey\"] is not a int.",
e.getMessage());
}
try {
Expand All @@ -1105,7 +1105,7 @@ public void jsonObjectNonAndWrongValues() {
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONObject[\"stringKey\"] is not a number.",
"JSONObject[\"stringKey\"] is not a long.",
e.getMessage());
}
try {
Expand Down Expand Up @@ -2087,7 +2087,7 @@ public void jsonObjectParsingErrors() {
fail("Expected an exception");
} catch (JSONException e) {
assertEquals("Expecting an exception message",
"JSONObject[myKey] is not a JSONArray.",
"JSONObject[\"myKey\"] is not a JSONArray (null).",
e.getMessage());
}
try {
Expand Down