1- package com .fasterxml .jackson .databind .deser ;
1+ package com .fasterxml .jackson .databind .deser . jdk ;
22
33import java .math .BigDecimal ;
44import java .math .BigInteger ;
1111
1212import com .fasterxml .jackson .databind .ObjectMapper ;
1313import com .fasterxml .jackson .databind .json .JsonMapper ;
14- import com .fasterxml .jackson .databind .testutil .DatabindTestUtil . DoubleWrapper ;
14+ import com .fasterxml .jackson .databind .testutil .DatabindTestUtil ;
1515
16+ import static org .junit .jupiter .api .Assertions .assertEquals ;
1617import static org .junit .jupiter .api .Assertions .assertNotNull ;
1718import static org .junit .jupiter .api .Assertions .fail ;
1819
19- import static com .fasterxml .jackson .databind .testutil .DatabindTestUtil .newJsonMapper ;
20- import static com .fasterxml .jackson .databind .testutil .DatabindTestUtil .verifyException ;
21-
2220public class BigNumbersDeserTest
21+ extends DatabindTestUtil
2322{
2423 static class BigIntegerWrapper {
2524 public BigInteger number ;
@@ -31,7 +30,7 @@ static class BigDecimalWrapper {
3130
3231 /*
3332 /**********************************************************
34- /* Tests
33+ /* Test methods
3534 /**********************************************************
3635 */
3736
@@ -103,6 +102,33 @@ public void testBigIntegerUnlimited() throws Exception
103102 assertNotNull (bdw );
104103 }
105104
105+ // [databind#4435]
106+ @ Test
107+ public void testNumberStartingWithDot () throws Exception
108+ {
109+ String num = ".555555555555555555555555555555" ;
110+ BigDecimalWrapper w = MAPPER .readValue ("{\" number\" :\" " + num + "\" }" , BigDecimalWrapper .class );
111+ assertEquals (new BigDecimal (num ), w .number );
112+ }
113+
114+ // [databind#4435]
115+ @ Test
116+ public void testNumberStartingWithMinusDot () throws Exception
117+ {
118+ String num = "-.555555555555555555555555555555" ;
119+ BigDecimalWrapper w = MAPPER .readValue ("{\" number\" :\" " + num + "\" }" , BigDecimalWrapper .class );
120+ assertEquals (new BigDecimal (num ), w .number );
121+ }
122+
123+ // [databind#4435]
124+ @ Test
125+ public void testNumberStartingWithPlusDot () throws Exception
126+ {
127+ String num = "+.555555555555555555555555555555" ;
128+ BigDecimalWrapper w = MAPPER .readValue ("{\" number\" :\" " + num + "\" }" , BigDecimalWrapper .class );
129+ assertEquals (new BigDecimal (num ), w .number );
130+ }
131+
106132 private String generateJson (final String fieldName ) {
107133 final int len = 1200 ;
108134 final StringBuilder sb = new StringBuilder ();
0 commit comments