@@ -20,7 +20,7 @@ public void testLongErrorMessage() throws Exception
20
20
21
21
public void testLongErrorMessageReader () throws Exception
22
22
{
23
- _testLongErrorMessage (MODE_READER );
23
+ _testLongErrorMessage (MODE_READER );
24
24
}
25
25
26
26
private void _testLongErrorMessage (int mode ) throws Exception
@@ -36,9 +36,10 @@ private void _testLongErrorMessage(int mode) throws Exception
36
36
fail ("Expected an exception for unrecognized token" );
37
37
} catch (JsonParseException jpe ) {
38
38
String msg = jpe .getMessage ();
39
- final String expectedPrefix = "Unrecognized token '" ;
40
- final String expectedSuffix = "...': was expecting ('true', 'false' or 'null')" ;
41
- assertTrue (msg .startsWith (expectedPrefix ));
39
+ final String expectedPrefix = "Unrecognized token '" ;
40
+ final String expectedSuffix = "...': was expecting" ;
41
+ verifyException (jpe , expectedPrefix );
42
+ verifyException (jpe , expectedSuffix );
42
43
assertTrue (msg .contains (expectedSuffix ));
43
44
int tokenLen = msg .indexOf (expectedSuffix ) - expectedPrefix .length ();
44
45
assertEquals (EXPECTED_MAX_TOKEN_LEN , tokenLen );
@@ -65,10 +66,10 @@ public void _testShortErrorMessage(int mode) throws Exception
65
66
} catch (JsonParseException jpe ) {
66
67
String msg = jpe .getMessage ();
67
68
final String expectedPrefix = "Unrecognized token '" ;
68
- final String expectedSuffix = "': was expecting ('true', 'false' or 'null') " ;
69
- assertTrue ( msg . startsWith ( expectedPrefix ) );
70
- assertTrue ( msg . contains ( expectedSuffix ) );
71
- int tokenLen = msg .indexOf (expectedSuffix ) - expectedPrefix .length ();
69
+ final String expectedSuffix = "': was expecting" ;
70
+ verifyException ( jpe , expectedPrefix );
71
+ verifyException ( jpe , expectedSuffix );
72
+ int tokenLen = msg .indexOf (expectedSuffix ) - expectedPrefix .length ();
72
73
assertEquals (DOC .length (), tokenLen );
73
74
}
74
75
jp .close ();
0 commit comments