17
17
import com .fasterxml .jackson .annotation .JsonAutoDetect .Visibility ;
18
18
import com .fasterxml .jackson .annotation .PropertyAccessor ;
19
19
import com .fasterxml .jackson .core .JsonProcessingException ;
20
- import com .fasterxml .jackson .databind .JsonMappingException ;
21
20
import com .fasterxml .jackson .databind .ObjectMapper ;
22
21
23
22
public class JacksonFieldUnitTest {
24
23
25
24
@ Test
26
- public final void givenDifferentAccessLevels_whenPrivateOrPackage_thenNotSerializable_whenPublic_thenSerializable () throws JsonProcessingException {
25
+ public final void givenDifferentAccessLevels_whenSerializing_thenPublicFieldsAreSerialized () throws JsonProcessingException {
27
26
final ObjectMapper mapper = new ObjectMapper ();
28
27
29
28
final MyDtoAccessLevel dtoObject = new MyDtoAccessLevel ();
@@ -48,7 +47,7 @@ public final void givenDifferentAccessLevels_whenGetterAdded_thenSerializable()
48
47
}
49
48
50
49
@ Test
51
- public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable () throws JsonProcessingException , JsonMappingException , IOException {
50
+ public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable () throws IOException {
52
51
final String jsonAsString = "{\" stringValue\" :\" dtoString\" ,\" booleanValue\" :\" true\" }" ;
53
52
final ObjectMapper mapper = new ObjectMapper ();
54
53
@@ -60,7 +59,7 @@ public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable(
60
59
}
61
60
62
61
@ Test
63
- public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable () throws JsonProcessingException , JsonMappingException , IOException {
62
+ public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable () throws IOException {
64
63
final String jsonAsString = "{\" stringValue\" :\" dtoString\" ,\" intValue\" :1}" ;
65
64
final ObjectMapper mapper = new ObjectMapper ();
66
65
@@ -72,7 +71,7 @@ public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable(
72
71
}
73
72
74
73
@ Test
75
- public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable () throws JsonProcessingException , JsonMappingException , IOException {
74
+ public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable () throws IOException {
76
75
final ObjectMapper mapper = new ObjectMapper ();
77
76
78
77
final MyDtoSetter dtoObject = new MyDtoSetter ();
@@ -84,7 +83,7 @@ public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSeriali
84
83
}
85
84
86
85
@ Test
87
- public final void givenDifferentAccessLevels_whenSetVisibility_thenSerializable () throws JsonProcessingException , JsonMappingException , IOException {
86
+ public final void givenDifferentAccessLevels_whenSetVisibility_thenSerializable () throws IOException {
88
87
final ObjectMapper mapper = new ObjectMapper ();
89
88
mapper .setVisibility (PropertyAccessor .ALL , Visibility .NONE );
90
89
mapper .setVisibility (PropertyAccessor .FIELD , Visibility .ANY );
0 commit comments