-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ed8707
commit 5ca5907
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
src/test/java/com/fasterxml/jackson/failing/NumberNodes1770Test.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,23 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
/** | ||
* Basic tests for {@link JsonNode} implementations that | ||
* contain numeric values. | ||
*/ | ||
public class NumberNodes1770Test extends BaseMapTest | ||
{ | ||
private final ObjectMapper MAPPER = newObjectMapper(); | ||
|
||
// Related to [databind#1770] | ||
public void testBigDecimalCoercion() throws Exception | ||
{ | ||
final JsonNode jsonNode = MAPPER.reader() | ||
.with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) | ||
.readTree("7976931348623157e309"); | ||
assertTrue(jsonNode.isBigDecimal()); | ||
// the following fails with NumberFormatException, because jsonNode is a DoubleNode with a value of POSITIVE_INFINITY | ||
// Assert.assertTrue(jsonNode.decimalValue().compareTo(new BigDecimal("7976931348623157e309")) == 0); | ||
} | ||
} |