Skip to content

Commit b9d56af

Browse files
authored
add tests for ints with 19 chars (#1337)
1 parent 4d47aae commit b9d56af

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void bigNumbers() throws Exception
454454
BigInteger biggie = new BigInteger(NUMBER_STR);
455455

456456
for (int mode : ALL_MODES) {
457-
try (JsonParser p = createParser(jsonFactory(), mode, NUMBER_STR +" ")) {
457+
try (JsonParser p = createParser(jsonFactory(), mode, NUMBER_STR + " ")) {
458458
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
459459
assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType());
460460
assertEquals(NUMBER_STR, p.getText());
@@ -463,6 +463,26 @@ void bigNumbers() throws Exception
463463
}
464464
}
465465

466+
@Test
467+
void intsWith19Chars() throws Exception
468+
{
469+
final String[] values = new String[] {
470+
"9223372036854775808", "9999999999999999999"
471+
};
472+
for (String value : values) {
473+
BigInteger biggie = new BigInteger(value);
474+
475+
for (int mode : ALL_MODES) {
476+
try (JsonParser p = createParser(jsonFactory(), mode, value + " ")) {
477+
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
478+
assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType());
479+
assertEquals(biggie, p.getBigIntegerValue());
480+
assertEquals(value, p.getText());
481+
}
482+
}
483+
}
484+
}
485+
466486
// Related to [core#1135]: JsonParser.isNaN() should not be fooled
467487
// by possible Double overflow
468488
@Test

0 commit comments

Comments
 (0)