Skip to content

Commit 7417b5f

Browse files
committed
test for issue FasterXML#4917
1 parent 17858e9 commit 7417b5f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKNumberDeserTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ static class NestedBigDecimalHolder2784 {
8181
public BigDecimalHolder2784 holder;
8282
}
8383

84+
static class DeserializationIssue4917 {
85+
public DecimalHolder4917 decimalHolder;
86+
public Double number;
87+
}
88+
89+
static class DecimalHolder4917 {
90+
public BigDecimal value;
91+
92+
public DecimalHolder4917(BigDecimal value) {
93+
this.value = value;
94+
}
95+
96+
@JsonCreator
97+
static DecimalHolder4917 of(BigDecimal value) {
98+
return new DecimalHolder4917(value);
99+
}
100+
}
101+
84102
/*
85103
/**********************************************************************
86104
/* Helper classes, serializers/deserializers/resolvers
@@ -415,4 +433,13 @@ public void bigDecimal4694FromBytes() throws Exception
415433
assertEquals(BIG_DEC, MAPPER.readValue(b, 0, b.length, BigDecimal.class));
416434
}
417435

436+
@Test
437+
public void bigDecimal4917() throws Exception
438+
{
439+
DeserializationIssue4917 issue = MAPPER.readValue(
440+
a2q("{'decimalHolder':100.00,'number':50}"),
441+
DeserializationIssue4917.class);
442+
assertEquals(new BigDecimal("100.00"), issue.decimalHolder.value);
443+
}
444+
418445
}

0 commit comments

Comments
 (0)