File tree 1 file changed +29
-0
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/deser
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,24 @@ static class NestedFloatHolder2784 {
74
74
public FloatHolder2784 holder ;
75
75
}
76
76
77
+ static class DeserializationIssue4917 {
78
+ public DecimalHolder4917 decimalHolder ;
79
+ public double number ;
80
+ }
81
+
82
+ static class DecimalHolder4917 {
83
+ public BigDecimal value ;
84
+
85
+ private DecimalHolder4917 (BigDecimal value ) {
86
+ this .value = value ;
87
+ }
88
+
89
+ @ JsonCreator (mode = JsonCreator .Mode .DELEGATING )
90
+ static DecimalHolder4917 of (BigDecimal value ) {
91
+ return new DecimalHolder4917 (value );
92
+ }
93
+ }
94
+
77
95
/*
78
96
/**********************************************************************
79
97
/* Test methods
@@ -160,4 +178,15 @@ public void testVeryBigDecimalUnwrappedWithUnlimitedNumLength() throws Exception
160
178
NestedBigDecimalHolder2784 result = new XmlMapper (f ).readValue (DOC , NestedBigDecimalHolder2784 .class );
161
179
assertEquals (new BigDecimal (value ), result .holder .value );
162
180
}
181
+
182
+ // [databind#4917]
183
+ @ Test
184
+ public void bigDecimal4917 () throws Exception
185
+ {
186
+ DeserializationIssue4917 issue = MAPPER .readValue (
187
+ "<root><decimalHolder>100.00</decimalHolder><number>50</number></root>" ,
188
+ DeserializationIssue4917 .class );
189
+ assertEquals (new BigDecimal ("100.00" ), issue .decimalHolder .value );
190
+ assertEquals (50.0 , issue .number );
191
+ }
163
192
}
You can’t perform that action at this time.
0 commit comments