Skip to content

Commit beae279

Browse files
author
John J. Aylward
committed
Updates tests to have updated message expectations
1 parent a642329 commit beae279

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/test/java/org/json/junit/JSONArrayTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public void failedGetArrayValues() {
412412
assertTrue("expected getBoolean to fail", false);
413413
} catch (JSONException e) {
414414
assertEquals("Expected an exception message",
415-
"JSONArray[4] is not a boolean.",e.getMessage());
415+
"JSONArray[4] is not a boolean (class java.lang.String : hello).",e.getMessage());
416416
}
417417
try {
418418
jsonArray.get(-1);
@@ -426,42 +426,42 @@ public void failedGetArrayValues() {
426426
assertTrue("expected getDouble to fail", false);
427427
} catch (JSONException e) {
428428
assertEquals("Expected an exception message",
429-
"JSONArray[4] is not a double.",e.getMessage());
429+
"JSONArray[4] is not a double (class java.lang.String : hello).",e.getMessage());
430430
}
431431
try {
432432
jsonArray.getInt(4);
433433
assertTrue("expected getInt to fail", false);
434434
} catch (JSONException e) {
435435
assertEquals("Expected an exception message",
436-
"JSONArray[4] is not a int.",e.getMessage());
436+
"JSONArray[4] is not a int (class java.lang.String : hello).",e.getMessage());
437437
}
438438
try {
439439
jsonArray.getJSONArray(4);
440440
assertTrue("expected getJSONArray to fail", false);
441441
} catch (JSONException e) {
442442
assertEquals("Expected an exception message",
443-
"JSONArray[4] is not a JSONArray.",e.getMessage());
443+
"JSONArray[4] is not a JSONArray (class java.lang.String : hello).",e.getMessage());
444444
}
445445
try {
446446
jsonArray.getJSONObject(4);
447447
assertTrue("expected getJSONObject to fail", false);
448448
} catch (JSONException e) {
449449
assertEquals("Expected an exception message",
450-
"JSONArray[4] is not a JSONObject.",e.getMessage());
450+
"JSONArray[4] is not a JSONObject (class java.lang.String : hello).",e.getMessage());
451451
}
452452
try {
453453
jsonArray.getLong(4);
454454
assertTrue("expected getLong to fail", false);
455455
} catch (JSONException e) {
456456
assertEquals("Expected an exception message",
457-
"JSONArray[4] is not a long.",e.getMessage());
457+
"JSONArray[4] is not a long (class java.lang.String : hello).",e.getMessage());
458458
}
459459
try {
460460
jsonArray.getString(5);
461461
assertTrue("expected getString to fail", false);
462462
} catch (JSONException e) {
463463
assertEquals("Expected an exception message",
464-
"JSONArray[5] is not a String.",e.getMessage());
464+
"JSONArray[5] is not a String (class java.math.BigDecimal : 0.002345).",e.getMessage());
465465
}
466466
}
467467

src/test/java/org/json/junit/JSONMLTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void emptyTagException() {
158158
assertTrue("Expecting an exception", false);
159159
} catch (JSONException e) {
160160
assertEquals("Expecting an exception message",
161-
"JSONArray[0] is not a String.",
161+
"JSONArray[0] is not a String (class org.json.JSONArray).",
162162
e.getMessage());
163163
}
164164
}

src/test/java/org/json/junit/JSONObjectTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ public void jsonObjectNonAndWrongValues() {
10901090
fail("Expected an exception");
10911091
} catch (JSONException e) {
10921092
assertEquals("Expecting an exception message",
1093-
"JSONObject[\"stringKey\"] is not a Boolean.",
1093+
"JSONObject[\"stringKey\"] is not a Boolean (class java.lang.String : hello world!).",
10941094
e.getMessage());
10951095
}
10961096
try {
@@ -1106,7 +1106,7 @@ public void jsonObjectNonAndWrongValues() {
11061106
fail("Expected an exception");
11071107
} catch (JSONException e) {
11081108
assertEquals("Expecting an exception message",
1109-
"JSONObject[\"trueKey\"] is not a string.",
1109+
"JSONObject[\"trueKey\"] is not a string (class java.lang.Boolean : true).",
11101110
e.getMessage());
11111111
}
11121112
try {
@@ -1122,7 +1122,7 @@ public void jsonObjectNonAndWrongValues() {
11221122
fail("Expected an exception");
11231123
} catch (JSONException e) {
11241124
assertEquals("Expecting an exception message",
1125-
"JSONObject[\"stringKey\"] is not a double.",
1125+
"JSONObject[\"stringKey\"] is not a double (class java.lang.String : hello world!).",
11261126
e.getMessage());
11271127
}
11281128
try {
@@ -1138,7 +1138,7 @@ public void jsonObjectNonAndWrongValues() {
11381138
fail("Expected an exception");
11391139
} catch (JSONException e) {
11401140
assertEquals("Expecting an exception message",
1141-
"JSONObject[\"stringKey\"] is not a float.",
1141+
"JSONObject[\"stringKey\"] is not a float (class java.lang.String : hello world!).",
11421142
e.getMessage());
11431143
}
11441144
try {
@@ -1154,7 +1154,7 @@ public void jsonObjectNonAndWrongValues() {
11541154
fail("Expected an exception");
11551155
} catch (JSONException e) {
11561156
assertEquals("Expecting an exception message",
1157-
"JSONObject[\"stringKey\"] is not a int.",
1157+
"JSONObject[\"stringKey\"] is not a int (class java.lang.String : hello world!).",
11581158
e.getMessage());
11591159
}
11601160
try {
@@ -1170,7 +1170,7 @@ public void jsonObjectNonAndWrongValues() {
11701170
fail("Expected an exception");
11711171
} catch (JSONException e) {
11721172
assertEquals("Expecting an exception message",
1173-
"JSONObject[\"stringKey\"] is not a long.",
1173+
"JSONObject[\"stringKey\"] is not a long (class java.lang.String : hello world!).",
11741174
e.getMessage());
11751175
}
11761176
try {
@@ -1186,7 +1186,7 @@ public void jsonObjectNonAndWrongValues() {
11861186
fail("Expected an exception");
11871187
} catch (JSONException e) {
11881188
assertEquals("Expecting an exception message",
1189-
"JSONObject[\"stringKey\"] is not a JSONArray.",
1189+
"JSONObject[\"stringKey\"] is not a JSONArray (class java.lang.String : hello world!).",
11901190
e.getMessage());
11911191
}
11921192
try {
@@ -1202,7 +1202,7 @@ public void jsonObjectNonAndWrongValues() {
12021202
fail("Expected an exception");
12031203
} catch (JSONException e) {
12041204
assertEquals("Expecting an exception message",
1205-
"JSONObject[\"stringKey\"] is not a JSONObject.",
1205+
"JSONObject[\"stringKey\"] is not a JSONObject (class java.lang.String : hello world!).",
12061206
e.getMessage());
12071207
}
12081208
}

0 commit comments

Comments
 (0)