diff --git a/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestCreatorsDelegating.java b/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestCreatorsDelegating.java index cf24e2e..63658ae 100644 --- a/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestCreatorsDelegating.java +++ b/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestCreatorsDelegating.java @@ -58,7 +58,7 @@ public static FactoryBean711 create(@JacksonInject String n1, int a, @JacksonInj /* Unit tests /********************************************************** */ - + public void testBooleanDelegate() throws Exception { ObjectMapper m = mapperWithModule(); diff --git a/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestFinalFields.java b/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestFinalFields.java new file mode 100644 index 0000000..9c2d312 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/module/afterburner/deser/TestFinalFields.java @@ -0,0 +1,56 @@ +package com.fasterxml.jackson.module.afterburner.deser; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.module.afterburner.AfterburnerTestBase; + +public class TestFinalFields extends AfterburnerTestBase +{ + static class Address { + public int zip1, zip2; + + public Address() { } + public Address(int z1, int z2) { + zip1 = z1; + zip2 = z2; + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + static class Organization + { + public final long id; + public final String name; + public final Address address; + + @JsonCreator + public Organization(@JsonProperty("id") long id, + @JsonProperty("name") String name, + @JsonProperty("address") Address address) + { + this.id = id; + this.name = name; + this.address = address; + } + } + + /* + /********************************************************** + /* Unit tests + /********************************************************** + */ + + public void testFinalFields() throws Exception + { + ObjectMapper mapper = mapperWithModule(); + String json = mapper.writeValueAsString(new Organization[] { + new Organization(123L, "Corp", new Address(98040, 98021)) + }); + Organization[] result = mapper.readValue(json, Organization[].class); + assertNotNull(result); + assertEquals(1, result.length); + assertNotNull(result[0]); + assertNotNull(result[0].address); + assertEquals(98021, result[0].address.zip2); + } +}