Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Commit 8862c25

Browse files
committed
Added unit test for issue #5 with paranamer using PropertyNamingStrategy
1 parent 9b98d40 commit 8862c25

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.fasterxml.jackson.module.paranamer;
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.databind.ObjectMapper;
5+
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
6+
7+
8+
public class TestCreatorWithNamingStrategy
9+
extends ParanamerTestBase {
10+
11+
static class CreatorBean
12+
{
13+
protected String myName;
14+
protected int myAge;
15+
16+
@JsonCreator
17+
public CreatorBean(int myAge, String myName)
18+
{
19+
this.myName = myName;
20+
this.myAge = myAge;
21+
}
22+
}
23+
24+
private final ObjectMapper MAPPER = new ObjectMapper()
25+
.registerModule(new ParanamerModule())
26+
.setPropertyNamingStrategy(PropertyNamingStrategy.PASCAL_CASE_TO_CAMEL_CASE);
27+
28+
public void testSimpleConstructor() throws Exception
29+
{
30+
CreatorBean bean = MAPPER.readValue("{ \"MyAge\" : 42, \"myName\" : \"NotMyRealName\" }", CreatorBean.class);
31+
assertEquals(42, bean.myAge);
32+
assertEquals("NotMyRealName", bean.myName);
33+
}
34+
35+
}

0 commit comments

Comments
 (0)