-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0583b3a
commit 85841c9
Showing
3 changed files
with
74 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyRename323.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
src/test/java/com/fasterxml/jackson/failing/TestPropertyConflict323.java
This file was deleted.
Oops, something went wrong.