2323public class JacksonFieldUnitTest {
2424
2525 @ Test
26- public final void givenDifferentAccessLevels_whenPrivateOrPackage_thenNotSerializable_whenPublic_thenSerializable () throws JsonProcessingException {
26+ public final void givenDifferentAccessLevels_whenPublic_thenSerializable () throws JsonProcessingException {
2727 final ObjectMapper mapper = new ObjectMapper ();
2828
2929 final MyDtoAccessLevel dtoObject = new MyDtoAccessLevel ();
@@ -49,42 +49,39 @@ public final void givenDifferentAccessLevels_whenGetterAdded_thenSerializable()
4949
5050 @ Test
5151 public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable () throws JsonProcessingException , JsonMappingException , IOException {
52- final String jsonAsString = "{\" stringValue\" :\" dtoString\" , \" booleanValue \" : \" true \" }" ;
52+ final String jsonAsString = "{\" stringValue\" :\" dtoString\" }" ;
5353 final ObjectMapper mapper = new ObjectMapper ();
5454
5555 final MyDtoGetterImplicitDeserialization dtoObject = mapper .readValue (jsonAsString , MyDtoGetterImplicitDeserialization .class );
5656
5757 assertNotNull (dtoObject );
5858 assertThat (dtoObject .getStringValue (), equalTo ("dtoString" ));
59- assertThat (dtoObject .booleanValue , equalTo (true ));
6059 }
6160
6261 @ Test
6362 public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable () throws JsonProcessingException , JsonMappingException , IOException {
64- final String jsonAsString = "{\" stringValue \" : \" dtoString \" , \" intValue\" :1}" ;
63+ final String jsonAsString = "{\" intValue\" :1}" ;
6564 final ObjectMapper mapper = new ObjectMapper ();
6665
6766 final MyDtoSetter dtoObject = mapper .readValue (jsonAsString , MyDtoSetter .class );
6867
6968 assertNotNull (dtoObject );
70- assertThat (dtoObject .getStringValue (), equalTo ("dtoString" ));
7169 assertThat (dtoObject .anotherGetIntValue (), equalTo (1 ));
7270 }
7371
7472 @ Test
75- public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable () throws JsonProcessingException , JsonMappingException , IOException {
73+ public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable () throws JsonProcessingException {
7674 final ObjectMapper mapper = new ObjectMapper ();
7775
7876 final MyDtoSetter dtoObject = new MyDtoSetter ();
7977
8078 final String dtoAsString = mapper .writeValueAsString (dtoObject );
81- assertThat (dtoAsString , containsString ("stringValue" ));
8279 assertThat (dtoAsString , not (containsString ("intValue" )));
8380 System .out .println (dtoAsString );
8481 }
8582
8683 @ Test
87- public final void givenDifferentAccessLevels_whenSetVisibility_thenSerializable () throws JsonProcessingException , JsonMappingException , IOException {
84+ public final void givenDifferentAccessLevels_whenSetVisibility_thenSerializable () throws JsonProcessingException {
8885 final ObjectMapper mapper = new ObjectMapper ();
8986 mapper .setVisibility (PropertyAccessor .ALL , Visibility .NONE );
9087 mapper .setVisibility (PropertyAccessor .FIELD , Visibility .ANY );
0 commit comments