File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
jackson/src/test/java/org/baeldung/jackson Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11package org .baeldung .jackson .field ;
22
3- public class MyDtoSetter {
3+ public class MyDtoWithSetter {
44
55 private int intValue ;
66 public boolean booleanValue ;
77
8- public MyDtoSetter () {
8+ public MyDtoWithSetter () {
99 super ();
1010 }
1111
12- public MyDtoSetter (final int intValue , final boolean booleanValue ) {
12+ public MyDtoWithSetter (final int intValue , final boolean booleanValue ) {
1313 super ();
1414
1515 this .intValue = intValue ;
@@ -22,7 +22,7 @@ public void setIntValue(final int intValue) {
2222 this .intValue = intValue ;
2323 }
2424
25- public int alternativeGetIntValue () {
25+ public int accessIntValue () {
2626 return intValue ;
2727 }
2828
Original file line number Diff line number Diff line change 99import java .io .IOException ;
1010
1111import org .baeldung .jackson .field .MyDtoAccessLevel ;
12- import org .baeldung .jackson .field .MyDtoSetter ;
12+ import org .baeldung .jackson .field .MyDtoWithSetter ;
1313import org .baeldung .jackson .field .MyDtoWithGetter ;
1414import org .junit .Test ;
1515
@@ -62,17 +62,17 @@ public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable(
6262 final String jsonAsString = "{\" intValue\" :1}" ;
6363 final ObjectMapper mapper = new ObjectMapper ();
6464
65- final MyDtoSetter dtoObject = mapper .readValue (jsonAsString , MyDtoSetter .class );
65+ final MyDtoWithSetter dtoObject = mapper .readValue (jsonAsString , MyDtoWithSetter .class );
6666
6767 assertNotNull (dtoObject );
68- assertThat (dtoObject .alternativeGetIntValue (), equalTo (1 ));
68+ assertThat (dtoObject .accessIntValue (), equalTo (1 ));
6969 }
7070
7171 @ Test
7272 public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable () throws IOException {
7373 final ObjectMapper mapper = new ObjectMapper ();
7474
75- final MyDtoSetter dtoObject = new MyDtoSetter ();
75+ final MyDtoWithSetter dtoObject = new MyDtoWithSetter ();
7676
7777 final String dtoAsString = mapper .writeValueAsString (dtoObject );
7878 assertThat (dtoAsString , not (containsString ("intValue" )));
You can’t perform that action at this time.
0 commit comments