Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
trying to reproduce issue #42, no luck yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 20, 2014
1 parent c23198a commit b368866
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static FactoryBean711 create(@JacksonInject String n1, int a, @JacksonInj
/* Unit tests
/**********************************************************
*/

public void testBooleanDelegate() throws Exception
{
ObjectMapper m = mapperWithModule();
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit b368866

Please sign in to comment.