Skip to content

Commit 6701b43

Browse files
committed
Clean up wrt JDK17/record test refactoring
1 parent 2160e54 commit 6701b43

5 files changed

+4
-51
lines changed

src/test/java/tools/jackson/databind/records/Jdk8ConstructorParameterNameAnnotationIntrospector.java

-31
This file was deleted.

src/test/java/tools/jackson/databind/records/RecordCreatorSerialization4452Test.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

1010
import tools.jackson.databind.ObjectMapper;
11-
import tools.jackson.databind.json.JsonMapper;
1211
import tools.jackson.databind.testutil.DatabindTestUtil;
1312

1413
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -35,10 +34,7 @@ public CreatorTestObject(
3534
}
3635
}
3736

38-
private final ObjectMapper OBJECT_MAPPER =
39-
JsonMapper.builder()
40-
.annotationIntrospector(new Jdk8ConstructorParameterNameAnnotationIntrospector())
41-
.build();
37+
private final ObjectMapper OBJECT_MAPPER = newJsonMapper();
4238

4339
@Test
4440
public void testPlain() throws Exception

src/test/java/tools/jackson/databind/records/RecordExplicitCreatorsTest.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ public void testDeserializeUsingImplicitCanonicalConstructor_WhenFactoryMethodsE
303303
public void testDeserializeMultipleConstructorsRecord_WithExplicitAndImplicitParameterNames_WithJsonCreator() throws Exception {
304304
final ObjectMapper mapper = jsonMapperBuilder()
305305
.disable(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS)
306-
.annotationIntrospector(new Jdk8ConstructorParameterNameAnnotationIntrospector())
307306
.build();
308307

309308
RecordWithJsonPropertyAndImplicitPropertyWithJsonCreator value = mapper.readValue(
@@ -321,10 +320,7 @@ public void testDeserializeMultipleConstructorsRecord_WithExplicitAndImplicitPar
321320
*/
322321
@Test
323322
public void testDeserializeMultipleConstructorsRecord_WithExplicitAndImplicitParameterNames() throws Exception {
324-
final ObjectMapper mapper = jsonMapperBuilder()
325-
.annotationIntrospector(new Jdk8ConstructorParameterNameAnnotationIntrospector())
326-
.build();
327-
RecordWithJsonPropertyAndImplicitPropertyWithoutJsonCreator value = mapper.readValue(
323+
RecordWithJsonPropertyAndImplicitPropertyWithoutJsonCreator value = MAPPER.readValue(
328324
"{\"id_only\":123,\"email\":\"[email protected]\"}",
329325
RecordWithJsonPropertyAndImplicitPropertyWithoutJsonCreator.class);
330326
assertEquals(123, value.id);

src/test/java/tools/jackson/databind/records/RecordImplicitCreatorsTest.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,7 @@ public void testDeserializeUsingImplicitDelegatingConstructor() throws Exception
325325
@Test
326326
public void testDeserializeMultipleConstructorsRecord_WithImplicitParameterNames_WillUseCanonicalConstructor() throws Exception
327327
{
328-
ObjectMapper mapper = jsonMapperBuilder()
329-
.annotationIntrospector(new Jdk8ConstructorParameterNameAnnotationIntrospector())
330-
.build();
331-
332-
RecordWithNonCanonicalConstructor value = mapper.readValue(
328+
RecordWithNonCanonicalConstructor value = MAPPER.readValue(
333329
"{\"id\":123,\"name\":\"Bob\",\"email\":\"[email protected]\"}",
334330
RecordWithNonCanonicalConstructor.class);
335331

@@ -339,10 +335,7 @@ public void testDeserializeMultipleConstructorsRecord_WithImplicitParameterNames
339335
@Test
340336
public void testDeserializeMultipleConstructorsRecord_WithImplicitParameterNames_WillIgnoreNonCanonicalConstructor() throws Exception
341337
{
342-
ObjectMapper mapper = jsonMapperBuilder()
343-
.annotationIntrospector(new Jdk8ConstructorParameterNameAnnotationIntrospector())
344-
.build();
345-
RecordWithNonCanonicalConstructor value = mapper.readValue(
338+
RecordWithNonCanonicalConstructor value = MAPPER.readValue(
346339
"{\"id\":123,\"email\":\"[email protected]\"}",
347340
RecordWithNonCanonicalConstructor.class);
348341

src/test/java/tools/jackson/databind/records/RecordImplicitSingleValueUsePropertiesBasedCreatorsTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public RecordWithSingleValueCanonAndMultiValueAltConstructor(String name, String
2727
}
2828

2929
private final ObjectMapper MAPPER = jsonMapperBuilder()
30-
.annotationIntrospector(new Jdk8ConstructorParameterNameAnnotationIntrospector())
3130
.constructorDetector(ConstructorDetector.USE_PROPERTIES_BASED)
3231
.build();
3332

0 commit comments

Comments
 (0)