File tree 2 files changed +43
-1
lines changed
src/test/java/com/fasterxml/jackson
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ static class EmptyListMapBean
126
126
127
127
public Map <String ,String > map = Collections .emptyMap ();
128
128
}
129
-
129
+
130
130
/*
131
131
/**********************************************************
132
132
/* Unit tests
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import java .util .*;
4
+
5
+ import com .fasterxml .jackson .annotation .JsonInclude ;
6
+
7
+ import com .fasterxml .jackson .databind .*;
8
+ import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
9
+
10
+ /**
11
+ * Unit tests for checking that alternative settings for
12
+ * {@link JsonSerialize#include} annotation property work
13
+ * as expected.
14
+ */
15
+ public class JsonInclude1327Test
16
+ extends BaseMapTest
17
+ {
18
+ @ JsonInclude (JsonInclude .Include .NON_EMPTY )
19
+ public static class Issues1327Bean {
20
+ public String myString = "stuff" ;
21
+ public List <String > myList = new ArrayList <String >();
22
+ }
23
+
24
+ /*
25
+ /**********************************************************
26
+ /* Unit tests
27
+ /**********************************************************
28
+ */
29
+
30
+ // for [databind#1327]
31
+ public void testIssue1327 () throws Exception {
32
+ ObjectMapper om = new ObjectMapper ();
33
+ om .setSerializationInclusion (JsonInclude .Include .NON_NULL );
34
+
35
+ final Issues1327Bean input = new Issues1327Bean ();
36
+ final String jsonString = om .writeValueAsString (input );
37
+
38
+ if (jsonString .contains ("myList" )) {
39
+ fail ("Should not contain `myList`: " +jsonString );
40
+ }
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments