Skip to content

Commit e979bc5

Browse files
committed
Add first test for #1327; passes with 2.7
1 parent 0aa6486 commit e979bc5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

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

+19-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,13 @@ static class NonEmptyDouble {
118118

119119
public NonEmptyDouble(double v) { value = v; }
120120
}
121-
121+
122+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
123+
public static class Issues1327Bean {
124+
public String myString = "stuff";
125+
public List<String> myList = new ArrayList<String>();
126+
}
127+
122128
/*
123129
/**********************************************************
124130
/* Unit tests
@@ -231,4 +237,16 @@ public void testEmptyInclusionScalars() throws IOException
231237
assertEquals("{\"i\":0}", defMapper.writeValueAsString(zero));
232238
assertEquals("{\"i\":0}", inclMapper.writeValueAsString(zero));
233239
}
240+
241+
public void testIssue1327() throws Exception {
242+
ObjectMapper om = new ObjectMapper();
243+
om.setSerializationInclusion(JsonInclude.Include.NON_NULL);
244+
245+
final Issues1327Bean input = new Issues1327Bean();
246+
final String jsonString = om.writeValueAsString(input);
247+
248+
if (jsonString.contains("myList")) {
249+
fail("Should not contain `myList`: "+jsonString);
250+
}
251+
}
234252
}

0 commit comments

Comments
 (0)