Skip to content

Commit f75b304

Browse files
committed
Merge branch '2.10'
2 parents f57e6a8 + daa935c commit f75b304

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/PropertyAliasTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ public void setXyz(int x) {
3030
}
3131
}
3232

33+
static class AliasBean2378 {
34+
String partitionId;
35+
String _id;
36+
37+
private AliasBean2378(boolean bogus, String partId, String userId) {
38+
partitionId = partId;
39+
_id = userId;
40+
}
41+
42+
@JsonCreator
43+
public static AliasBean2378 create(@JsonProperty("partitionId") String partId,
44+
@JsonProperty("id") @JsonAlias("userId") String userId) {
45+
return new AliasBean2378(false, partId, userId);
46+
}
47+
}
48+
3349
static class PolyWrapperForAlias {
3450
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
3551
include = JsonTypeInfo.As.WRAPPER_ARRAY)
@@ -81,4 +97,14 @@ public void testAliasWithPolymorphic() throws Exception
8197
assertEquals("Bob", bean.name);
8298
assertEquals(17, bean._a);
8399
}
100+
101+
// [databind#2378]
102+
public void testAliasInFactoryMethod() throws Exception
103+
{
104+
AliasBean2378 bean = MAPPER.readValue(aposToQuotes(
105+
"{'partitionId' : 'a', 'userId' : '123'}"
106+
), AliasBean2378.class);
107+
assertEquals("a", bean.partitionId);
108+
assertEquals("123", bean._id);
109+
}
84110
}

0 commit comments

Comments
 (0)