Skip to content

Commit

Permalink
Fixed #323
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 6, 2014
1 parent 0583b3a commit 85841c9
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 38 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Version: 2.4.0-rc1 (26-Apr-2014)
(implemented by Pascal G)
#193: Conflicting property name definitions
(reported by Stuart J, sgjohnston@github)
#323: Serialization of the field with deserialization config
(reported by metanet@github)
#327: Should not consider explicitly differing renames a fail, as long as all are explici
#335: Allow use of `@JsonPropertyOrder(alphabetic=true)` for Map properties
#352 Add `ObjectMapper.setConfig()` for overriding `SerializationConfig`/`DeserializationConfig`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.fasterxml.jackson.databind.introspect;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;

/**
* Unit tests verifying handling of potential and actual
* conflicts, regarding property handling.
*/
public class TestPropertyRename323 extends BaseMapTest
{
static class Bean323WithIgnore {
@JsonIgnore
private int a;

public Bean323WithIgnore(@JsonProperty("a") final int a ) {
this.a = a;
}

@JsonProperty("b")
private int getA () {
return a;
}
}

static class Bean323WithExplicitCleave1 {
@JsonProperty("a")
private int a;

public Bean323WithExplicitCleave1(@JsonProperty("a") final int a ) {
this.a = a;
}

@JsonProperty("b")
private int getA () {
return a;
}
}

@JsonPropertyOrder({ "a","b" })
static class Bean323WithExplicitCleave2 {
@JsonProperty("b")
private int a;

public Bean323WithExplicitCleave2(@JsonProperty("a") final int a ) {
this.a = a;
}

@JsonProperty("b")
private int getA () {
return a;
}
}

/*
/**********************************************************
/* Test methods
/**********************************************************
*/

public void testCreatorPropRenameWithIgnore() throws Exception
{
Bean323WithIgnore input = new Bean323WithIgnore(7);
assertEquals("{\"b\":7}", objectWriter().writeValueAsString(input));
}

public void testCreatorPropRenameWithCleave() throws Exception
{
assertEquals("{\"a\":7,\"b\":7}", objectWriter().writeValueAsString(new Bean323WithExplicitCleave1(7)));
assertEquals("{\"b\":7}", objectWriter().writeValueAsString(new Bean323WithExplicitCleave2(7)));
}
}

This file was deleted.

0 comments on commit 85841c9

Please sign in to comment.