-
-
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
2dae72f
commit 0f9a4a5
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/test/java/com/fasterxml/jackson/failing/Ignore1317Test.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,50 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.beans.ConstructorProperties; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class Ignore1317Test extends BaseMapTest | ||
{ | ||
static class Testing { | ||
@JsonIgnore | ||
public String ignore; | ||
|
||
String notIgnore; | ||
|
||
public Testing() {} | ||
|
||
@ConstructorProperties({"ignore", "notIgnore"}) | ||
public Testing(String ignore, String notIgnore) { | ||
super(); | ||
this.ignore = ignore; | ||
this.notIgnore = notIgnore; | ||
} | ||
|
||
public String getIgnore() { | ||
return ignore; | ||
} | ||
|
||
public void setIgnore(String ignore) { | ||
this.ignore = ignore; | ||
} | ||
|
||
public String getNotIgnore() { | ||
return notIgnore; | ||
} | ||
|
||
public void setNotIgnore(String notIgnore) { | ||
this.notIgnore = notIgnore; | ||
} | ||
} | ||
|
||
public void testThatJsonIgnoreWorksWithConstructorProperties() throws Exception { | ||
Testing testing = new Testing("shouldBeIgnored", "notIgnore"); | ||
ObjectMapper om = new ObjectMapper(); | ||
String json = om.writeValueAsString(testing); | ||
System.out.println(json); | ||
assertFalse(json.contains("shouldBeIgnored")); | ||
} | ||
} |