@@ -184,7 +184,8 @@ public void givenInvalidStringArray_testStrictModeTrue_shouldThrowJsonException(
184184 .withStrictMode (true );
185185 String testCase = "[badString]" ;
186186 JSONException je = assertThrows (JSONException .class , () -> new JSONArray (testCase , jsonParserConfiguration ));
187- assertEquals ("Value 'badString' is not surrounded by quotes at 10 [character 11 line 1]" , je .getMessage ());
187+ assertEquals ("Strict mode error: Value 'badString' is not surrounded by quotes at 10 [character 11 line 1]" ,
188+ je .getMessage ());
188189 }
189190
190191 @ Test
@@ -193,7 +194,8 @@ public void givenInvalidStringObject_testStrictModeTrue_shouldThrowJsonException
193194 .withStrictMode (true );
194195 String testCase = "{\" a0\" :badString}" ;
195196 JSONException je = assertThrows (JSONException .class , () -> new JSONObject (testCase , jsonParserConfiguration ));
196- assertEquals ("Value 'badString' is not surrounded by quotes at 15 [character 16 line 1]" , je .getMessage ());
197+ assertEquals ("Strict mode error: Value 'badString' is not surrounded by quotes at 15 [character 16 line 1]" ,
198+ je .getMessage ());
197199 }
198200
199201 @ Test
@@ -289,7 +291,8 @@ public void givenInvalidInputArray_testStrictModeTrue_shouldThrowInvalidCharacte
289291 String testCase = "[1,2];[3,4]" ;
290292 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
291293 JSONException .class , () -> new JSONArray (testCase , jsonParserConfiguration ));
292- assertEquals ("invalid character ';' found after end of array at 6 [character 7 line 1]" , je .getMessage ());
294+ assertEquals ("Strict mode error: Unparsed characters found at end of input text at 6 [character 7 line 1]" ,
295+ je .getMessage ());
293296 }
294297
295298 @ Test
@@ -299,7 +302,7 @@ public void givenInvalidInputObject_testStrictModeTrue_shouldThrowInvalidCharact
299302 String testCase = "{\" a0\" :[1,2];\" a1\" :[3,4]}" ;
300303 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
301304 JSONException .class , () -> new JSONObject (testCase , jsonParserConfiguration ));
302- assertEquals ("Invalid character ';' found in object in strict mode at 12 [character 13 line 1]" , je .getMessage ());
305+ assertEquals ("Strict mode error: Invalid character ';' found at 12 [character 13 line 1]" , je .getMessage ());
303306 }
304307
305308 @ Test
@@ -309,7 +312,8 @@ public void givenInvalidInputArrayWithNumericStrings_testStrictModeTrue_shouldTh
309312 String testCase = "[\" 1\" ,\" 2\" ];[3,4]" ;
310313 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
311314 JSONException .class , () -> new JSONArray (testCase , jsonParserConfiguration ));
312- assertEquals ("invalid character ';' found after end of array at 10 [character 11 line 1]" , je .getMessage ());
315+ assertEquals ("Strict mode error: Unparsed characters found at end of input text at 10 [character 11 line 1]" ,
316+ je .getMessage ());
313317 }
314318
315319 @ Test
@@ -319,7 +323,7 @@ public void givenInvalidInputObjectWithNumericStrings_testStrictModeTrue_shouldT
319323 String testCase = "{\" a0\" :[\" 1\" ,\" 2\" ];\" a1\" :[3,4]}" ;
320324 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
321325 JSONException .class , () -> new JSONObject (testCase , jsonParserConfiguration ));
322- assertEquals ("Invalid character ';' found in object in strict mode at 16 [character 17 line 1]" , je .getMessage ());
326+ assertEquals ("Strict mode error: Invalid character ';' found at 16 [character 17 line 1]" , je .getMessage ());
323327 }
324328
325329 @ Test
@@ -329,7 +333,8 @@ public void givenInvalidInputArray_testStrictModeTrue_shouldThrowValueNotSurroun
329333 String testCase = "[{\" test\" : implied}]" ;
330334 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
331335 JSONException .class , () -> new JSONArray (testCase , jsonParserConfiguration ));
332- assertEquals ("Value 'implied' is not surrounded by quotes at 17 [character 18 line 1]" , je .getMessage ());
336+ assertEquals ("Strict mode error: Value 'implied' is not surrounded by quotes at 17 [character 18 line 1]" ,
337+ je .getMessage ());
333338 }
334339
335340 @ Test
@@ -339,7 +344,8 @@ public void givenInvalidInputObject_testStrictModeTrue_shouldThrowValueNotSurrou
339344 String testCase = "{\" a0\" :{\" test\" : implied}]}" ;
340345 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
341346 JSONException .class , () -> new JSONObject (testCase , jsonParserConfiguration ));
342- assertEquals ("Value 'implied' is not surrounded by quotes at 22 [character 23 line 1]" , je .getMessage ());
347+ assertEquals ("Strict mode error: Value 'implied' is not surrounded by quotes at 22 [character 23 line 1]" ,
348+ je .getMessage ());
343349 }
344350
345351 @ Test
@@ -381,13 +387,13 @@ public void givenNonCompliantQuotesArray_testStrictModeTrue_shouldThrowJsonExcep
381387 "Expected a ',' or ']' at 10 [character 11 line 1]" ,
382388 jeOne .getMessage ());
383389 assertEquals (
384- "Single quote wrap not allowed in strict mode at 2 [character 3 line 1]" ,
390+ "Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]" ,
385391 jeTwo .getMessage ());
386392 assertEquals (
387- "Single quote wrap not allowed in strict mode at 2 [character 3 line 1]" ,
393+ "Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]" ,
388394 jeThree .getMessage ());
389395 assertEquals (
390- "Single quote wrap not allowed in strict mode at 3 [character 4 line 1]" ,
396+ "Strict mode error: Single quoted strings are not allowed at 3 [character 4 line 1]" ,
391397 jeFour .getMessage ());
392398 }
393399
@@ -414,13 +420,13 @@ public void givenNonCompliantQuotesObject_testStrictModeTrue_shouldThrowJsonExce
414420 "Expected a ':' after a key at 10 [character 11 line 1]" ,
415421 jeOne .getMessage ());
416422 assertEquals (
417- "Single quote wrap not allowed in strict mode at 2 [character 3 line 1]" ,
423+ "Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]" ,
418424 jeTwo .getMessage ());
419425 assertEquals (
420- "Single quote wrap not allowed in strict mode at 6 [character 7 line 1]" ,
426+ "Strict mode error: Single quoted strings are not allowed at 6 [character 7 line 1]" ,
421427 jeThree .getMessage ());
422428 assertEquals (
423- "Single quote wrap not allowed in strict mode at 2 [character 3 line 1]" ,
429+ "Strict mode error: Single quoted strings are not allowed at 2 [character 3 line 1]" ,
424430 jeFour .getMessage ());
425431 }
426432
@@ -467,7 +473,8 @@ public void givenInvalidInputArray_testStrictModeTrue_shouldThrowKeyNotSurrounde
467473 JSONException je = assertThrows ("expected non-compliant array but got instead: " + testCase ,
468474 JSONException .class , () -> new JSONArray (testCase , jsonParserConfiguration ));
469475
470- assertEquals ("Value 'test' is not surrounded by quotes at 6 [character 7 line 1]" , je .getMessage ());
476+ assertEquals ("Strict mode error: Value 'test' is not surrounded by quotes at 6 [character 7 line 1]" ,
477+ je .getMessage ());
471478 }
472479
473480 @ Test
@@ -479,7 +486,8 @@ public void givenInvalidInputObject_testStrictModeTrue_shouldThrowKeyNotSurround
479486 JSONException je = assertThrows ("expected non-compliant json but got instead: " + testCase ,
480487 JSONException .class , () -> new JSONObject (testCase , jsonParserConfiguration ));
481488
482- assertEquals ("Value 'test' is not surrounded by quotes at 5 [character 6 line 1]" , je .getMessage ());
489+ assertEquals ("Strict mode error: Value 'test' is not surrounded by quotes at 5 [character 6 line 1]" ,
490+ je .getMessage ());
483491 }
484492
485493 /**
@@ -492,6 +500,8 @@ private List<String> getNonCompliantJSONArrayList() {
492500 return Arrays .asList (
493501 "[1]," ,
494502 "[1,]" ,
503+ "[,]" ,
504+ "[,,]" ,
495505 "[[1],\" sa\" ,[2]]a" ,
496506 "[1],\" dsa\" : \" test\" " ,
497507 "[[a]]" ,
0 commit comments