-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create NonStandardNumberParsing4694Test.java (#1334)
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/test/java/com/fasterxml/jackson/failing/NonStandardNumberParsing4694Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import com.fasterxml.jackson.core.JUnit5TestBase; | ||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.core.JsonToken; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
class NonStandardNumberParsing4694Test | ||
extends JUnit5TestBase | ||
{ | ||
// https://github.com/FasterXML/jackson-databind/issues/4694 | ||
@Test | ||
void databind4694() throws Exception { | ||
final String str = "-11000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; | ||
final BigDecimal expected = new BigDecimal(str); | ||
for (int mode : ALL_MODES) { | ||
try (JsonParser p = createParser(mode, String.format(" %s ", str))) { | ||
assertEquals(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); | ||
assertEquals(expected, p.getDecimalValue()); | ||
assertFalse(p.isNaN()); | ||
} | ||
} | ||
} | ||
} |