File tree 2 files changed +26
-1
lines changed
src/test/java/com/fasterxml/jackson/failing
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,16 @@ public void testHierarchy() throws IOException {
19
19
20
20
Fleet fleet = initVehicle ();
21
21
22
+ /*
22
23
for (Vehicle v : fleet.vehicles) {
23
24
System.out.println("Vehicle, type: "+v.getClass());
24
25
}
26
+ */
25
27
String serializedFleet = mapper
26
28
.writerWithDefaultPrettyPrinter ()
27
29
.writeValueAsString (fleet );
28
30
29
- System .out .println (serializedFleet );
31
+ // System.out.println(serializedFleet);
30
32
31
33
Fleet deserializedFleet = mapper .readValue (serializedFleet , Fleet .class );
32
34
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .databind .*;
4
+
5
+ /**
6
+ * Basic tests for {@link JsonNode} implementations that
7
+ * contain numeric values.
8
+ */
9
+ public class NumberNodes1770Test extends BaseMapTest
10
+ {
11
+ private final ObjectMapper MAPPER = newObjectMapper ();
12
+
13
+ // Related to [databind#1770]
14
+ public void testBigDecimalCoercion () throws Exception
15
+ {
16
+ final JsonNode jsonNode = MAPPER .reader ()
17
+ .with (DeserializationFeature .USE_BIG_DECIMAL_FOR_FLOATS )
18
+ .readTree ("7976931348623157e309" );
19
+ assertTrue (jsonNode .isBigDecimal ());
20
+ // the following fails with NumberFormatException, because jsonNode is a DoubleNode with a value of POSITIVE_INFINITY
21
+ // Assert.assertTrue(jsonNode.decimalValue().compareTo(new BigDecimal("7976931348623157e309")) == 0);
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments