From 8862c251daa6e2acff54948a298ed5f97d6bc893 Mon Sep 17 00:00:00 2001 From: cpilsworth Date: Mon, 6 Jan 2014 21:31:35 +0000 Subject: [PATCH] Added unit test for issue #5 with paranamer using PropertyNamingStrategy --- .../TestCreatorWithNamingStrategy.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/test/java/com/fasterxml/jackson/module/paranamer/TestCreatorWithNamingStrategy.java diff --git a/src/test/java/com/fasterxml/jackson/module/paranamer/TestCreatorWithNamingStrategy.java b/src/test/java/com/fasterxml/jackson/module/paranamer/TestCreatorWithNamingStrategy.java new file mode 100644 index 0000000..f391053 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/module/paranamer/TestCreatorWithNamingStrategy.java @@ -0,0 +1,35 @@ +package com.fasterxml.jackson.module.paranamer; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; + + +public class TestCreatorWithNamingStrategy + extends ParanamerTestBase { + + static class CreatorBean + { + protected String myName; + protected int myAge; + + @JsonCreator + public CreatorBean(int myAge, String myName) + { + this.myName = myName; + this.myAge = myAge; + } + } + + private final ObjectMapper MAPPER = new ObjectMapper() + .registerModule(new ParanamerModule()) + .setPropertyNamingStrategy(PropertyNamingStrategy.PASCAL_CASE_TO_CAMEL_CASE); + + public void testSimpleConstructor() throws Exception + { + CreatorBean bean = MAPPER.readValue("{ \"MyAge\" : 42, \"myName\" : \"NotMyRealName\" }", CreatorBean.class); + assertEquals(42, bean.myAge); + assertEquals("NotMyRealName", bean.myName); + } + +}