Skip to content

Commit

Permalink
Add a regression test for #157; was NOT failing on 2.3 (i.e. regressi…
Browse files Browse the repository at this point in the history
…on in 2.4)
  • Loading branch information
cowtowncoder committed Oct 8, 2014
1 parent ea6d687 commit 8c700f5
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,38 @@ public void testParsingOfLongerSequences()
}
}

// [jackson-core#157]
public void testLongNumbers() throws Exception
{
StringBuilder sb = new StringBuilder(9000);
for (int i = 0; i < 9000; ++i) {
sb.append('9');
}
String NUM = sb.toString();
JsonFactory f = new JsonFactory();
_testLongNumbers(f, NUM, false);
_testLongNumbers(f, NUM, true);
}

private void _testLongNumbers(JsonFactory f, String num, boolean useStream) throws Exception
{
final String doc = "[ "+num+" ]";
JsonParser jp = useStream
? f.createParser(doc.getBytes("UTF-8"))
: f.createParser(doc);
assertToken(JsonToken.START_ARRAY, jp.nextToken());
assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken());
assertEquals(num, jp.getText());
assertToken(JsonToken.END_ARRAY, jp.nextToken());
}

/*
/**********************************************************
/* Tests for invalid access
/**********************************************************
*/

public void testInvalidBooleanAccess()
throws Exception
public void testInvalidBooleanAccess() throws Exception
{
JsonParser jp = createParserUsingReader("[ \"abc\" ]");
assertToken(JsonToken.START_ARRAY, jp.nextToken());
Expand Down

0 comments on commit 8c700f5

Please sign in to comment.