Skip to content

Commit 3074920

Browse files
author
eugenp
committed
minor jackson testing work
1 parent 04f7919 commit 3074920

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

jackson/src/test/java/org/baeldung/jackson/test/JacksonFieldUnitTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
1818
import com.fasterxml.jackson.annotation.PropertyAccessor;
1919
import com.fasterxml.jackson.core.JsonProcessingException;
20-
import com.fasterxml.jackson.databind.JsonMappingException;
2120
import com.fasterxml.jackson.databind.ObjectMapper;
2221

2322
public class JacksonFieldUnitTest {
2423

2524
@Test
26-
public final void givenDifferentAccessLevels_whenPrivateOrPackage_thenNotSerializable_whenPublic_thenSerializable() throws JsonProcessingException {
25+
public final void givenDifferentAccessLevels_whenSerializing_thenPublicFieldsAreSerialized() throws JsonProcessingException {
2726
final ObjectMapper mapper = new ObjectMapper();
2827

2928
final MyDtoAccessLevel dtoObject = new MyDtoAccessLevel();
@@ -48,7 +47,7 @@ public final void givenDifferentAccessLevels_whenGetterAdded_thenSerializable()
4847
}
4948

5049
@Test
51-
public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable() throws JsonProcessingException, JsonMappingException, IOException {
50+
public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable() throws IOException {
5251
final String jsonAsString = "{\"stringValue\":\"dtoString\",\"booleanValue\":\"true\"}";
5352
final ObjectMapper mapper = new ObjectMapper();
5453

@@ -60,7 +59,7 @@ public final void givenDifferentAccessLevels_whenGetterAdded_thenDeserializable(
6059
}
6160

6261
@Test
63-
public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable() throws JsonProcessingException, JsonMappingException, IOException {
62+
public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable() throws IOException {
6463
final String jsonAsString = "{\"stringValue\":\"dtoString\",\"intValue\":1}";
6564
final ObjectMapper mapper = new ObjectMapper();
6665

@@ -72,7 +71,7 @@ public final void givenDifferentAccessLevels_whenSetterAdded_thenDeserializable(
7271
}
7372

7473
@Test
75-
public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable() throws JsonProcessingException, JsonMappingException, IOException {
74+
public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSerializable() throws IOException {
7675
final ObjectMapper mapper = new ObjectMapper();
7776

7877
final MyDtoSetter dtoObject = new MyDtoSetter();
@@ -84,7 +83,7 @@ public final void givenDifferentAccessLevels_whenSetterAdded_thenStillNotSeriali
8483
}
8584

8685
@Test
87-
public final void givenDifferentAccessLevels_whenSetVisibility_thenSerializable() throws JsonProcessingException, JsonMappingException, IOException {
86+
public final void givenDifferentAccessLevels_whenSetVisibility_thenSerializable() throws IOException {
8887
final ObjectMapper mapper = new ObjectMapper();
8988
mapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
9089
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);

0 commit comments

Comments
 (0)