Skip to content

Commit c8e577d

Browse files
authored
test issue 4741 (#4743)
make test better match issue
1 parent b6da0d5 commit c8e577d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ public DefaultIntBean(int i1, Integer i2) {
100100
}
101101
}
102102

103+
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
104+
static class NonDefaultBean4741 {
105+
private String value = null;
106+
107+
public String getValue() {
108+
return value;
109+
}
110+
111+
public void setValue(String value) {
112+
this.value = value;
113+
}
114+
}
115+
103116
static class NonEmptyString {
104117
@JsonInclude(JsonInclude.Include.NON_EMPTY)
105118
public String value;
@@ -318,6 +331,15 @@ public void testIssue1351() throws Exception
318331
mapper.writeValueAsString(new Issue1351NonBean(0)));
319332
}
320333

334+
// [databind#4741]
335+
public void testSerialization4741() throws Exception
336+
{
337+
ObjectMapper mapper = new ObjectMapper();
338+
NonDefaultBean4741 bean = new NonDefaultBean4741();
339+
bean.setValue("");
340+
assertEquals(a2q("{'value':''}"), mapper.writeValueAsString(bean));
341+
}
342+
321343
// [databind#1550]
322344
public void testInclusionOfDate() throws Exception
323345
{

0 commit comments

Comments
 (0)