diff --git a/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java b/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java index c64a9f732f..198e7da089 100644 --- a/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java +++ b/src/test/java/com/fasterxml/jackson/core/read/NumberParsingTest.java @@ -454,7 +454,7 @@ void bigNumbers() throws Exception BigInteger biggie = new BigInteger(NUMBER_STR); for (int mode : ALL_MODES) { - try (JsonParser p = createParser(jsonFactory(), mode, NUMBER_STR +" ")) { + try (JsonParser p = createParser(jsonFactory(), mode, NUMBER_STR + " ")) { assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); assertEquals(NUMBER_STR, p.getText()); @@ -463,6 +463,26 @@ void bigNumbers() throws Exception } } + @Test + void intsWith19Chars() throws Exception + { + final String[] values = new String[] { + "9223372036854775808", "9999999999999999999" + }; + for (String value : values) { + BigInteger biggie = new BigInteger(value); + + for (int mode : ALL_MODES) { + try (JsonParser p = createParser(jsonFactory(), mode, value + " ")) { + assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); + assertEquals(JsonParser.NumberType.BIG_INTEGER, p.getNumberType()); + assertEquals(biggie, p.getBigIntegerValue()); + assertEquals(value, p.getText()); + } + } + } + } + // Related to [core#1135]: JsonParser.isNaN() should not be fooled // by possible Double overflow @Test