Skip to content

Commit 0f9a4a5

Browse files
committed
Add a failing test for #1317
1 parent 2dae72f commit 0f9a4a5

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import java.beans.ConstructorProperties;
4+
5+
import com.fasterxml.jackson.annotation.JsonIgnore;
6+
7+
import com.fasterxml.jackson.databind.*;
8+
9+
public class Ignore1317Test extends BaseMapTest
10+
{
11+
static class Testing {
12+
@JsonIgnore
13+
public String ignore;
14+
15+
String notIgnore;
16+
17+
public Testing() {}
18+
19+
@ConstructorProperties({"ignore", "notIgnore"})
20+
public Testing(String ignore, String notIgnore) {
21+
super();
22+
this.ignore = ignore;
23+
this.notIgnore = notIgnore;
24+
}
25+
26+
public String getIgnore() {
27+
return ignore;
28+
}
29+
30+
public void setIgnore(String ignore) {
31+
this.ignore = ignore;
32+
}
33+
34+
public String getNotIgnore() {
35+
return notIgnore;
36+
}
37+
38+
public void setNotIgnore(String notIgnore) {
39+
this.notIgnore = notIgnore;
40+
}
41+
}
42+
43+
public void testThatJsonIgnoreWorksWithConstructorProperties() throws Exception {
44+
Testing testing = new Testing("shouldBeIgnored", "notIgnore");
45+
ObjectMapper om = new ObjectMapper();
46+
String json = om.writeValueAsString(testing);
47+
System.out.println(json);
48+
assertFalse(json.contains("shouldBeIgnored"));
49+
}
50+
}

0 commit comments

Comments
 (0)