Skip to content

Commit

Permalink
Add a failing test for #1317
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 16, 2017
1 parent 2dae72f commit 0f9a4a5
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/test/java/com/fasterxml/jackson/failing/Ignore1317Test.java
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"));
}
}

0 comments on commit 0f9a4a5

Please sign in to comment.