1
1
package com .fasterxml .jackson .databind .views ;
2
2
3
+ import static com .fasterxml .jackson .databind .DatabindTestUtil .jsonMapperBuilder ;
4
+ import static com .fasterxml .jackson .databind .DatabindTestUtil .newJsonMapper ;
5
+ import static com .fasterxml .jackson .databind .DatabindTestUtil .writeAndMap ;
6
+ import static org .junit .Assert .assertEquals ;
7
+ import static org .junit .Assert .assertNull ;
3
8
import java .io .*;
4
9
import java .util .*;
5
10
6
11
import com .fasterxml .jackson .annotation .*;
7
12
8
13
import com .fasterxml .jackson .databind .*;
14
+ import org .junit .jupiter .api .Test ;
9
15
10
16
/**
11
17
* Unit tests for verifying JSON view functionality: ability to declaratively
12
18
* suppress subset of properties from being serialized.
13
19
*/
14
20
public class TestViewSerialization
15
- extends BaseMapTest
16
21
{
17
22
// Classes that represent views
18
23
static class ViewA { }
@@ -75,9 +80,10 @@ public static class Foo {
75
80
/**********************************************************
76
81
*/
77
82
78
- private final ObjectMapper MAPPER = objectMapper ();
83
+ private final ObjectMapper MAPPER = newJsonMapper ();
79
84
80
85
@ SuppressWarnings ("unchecked" )
86
+ @ Test
81
87
public void testSimple () throws IOException
82
88
{
83
89
StringWriter sw = new StringWriter ();
@@ -128,6 +134,7 @@ public void testSimple() throws IOException
128
134
* a view.
129
135
*/
130
136
@ SuppressWarnings ("unchecked" )
137
+ @ Test
131
138
public void testDefaultExclusion () throws IOException
132
139
{
133
140
MixedBean bean = new MixedBean ();
@@ -163,12 +170,14 @@ public void testDefaultExclusion() throws IOException
163
170
* As per [JACKSON-261], @JsonView annotation should imply that associated
164
171
* method/field does indicate a property.
165
172
*/
173
+ @ Test
166
174
public void testImplicitAutoDetection () throws Exception
167
175
{
168
176
assertEquals ("{\" a\" :1}" ,
169
177
MAPPER .writeValueAsString (new ImplicitBean ()));
170
178
}
171
179
180
+ @ Test
172
181
public void testVisibility () throws Exception
173
182
{
174
183
VisibilityBean bean = new VisibilityBean ();
@@ -179,6 +188,7 @@ public void testVisibility() throws Exception
179
188
}
180
189
181
190
// [JACKSON-868]
191
+ @ Test
182
192
public void test868 () throws IOException
183
193
{
184
194
ObjectMapper mapper = new ObjectMapper ();
0 commit comments