From 1e33b1a9da27b203a7ced763bfd9313102a40e91 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 8 Jul 2022 09:29:34 +0200 Subject: [PATCH] Polish "Add reflection hints for Jackson's basic serializers" --- .../boot/json/JacksonRuntimeHintsTests.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonRuntimeHintsTests.java index 3585380d79..5b911a090d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonRuntimeHintsTests.java @@ -17,6 +17,7 @@ package org.springframework.boot.json; import java.util.Set; +import java.util.stream.Stream; import com.fasterxml.jackson.databind.ser.std.ClassSerializer; import com.fasterxml.jackson.databind.ser.std.FileSerializer; @@ -43,14 +44,14 @@ class JacksonRuntimeHintsTests { @Test void shouldRegisterSerializerConstructors() { ReflectionHints hints = registerHints(); - var serializers = Set.of(AtomicBooleanSerializer.class, AtomicIntegerSerializer.class, - AtomicLongSerializer.class, FileSerializer.class, ClassSerializer.class, TokenBufferSerializer.class); - for (var serializer : serializers) { - TypeHint typeHint = hints.getTypeHint(serializer); - assertThat(typeHint).withFailMessage(() -> "No hints found for serializer " + serializer).isNotNull(); - Set memberCategories = typeHint.getMemberCategories(); - assertThat(memberCategories).containsExactly(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS); - } + Stream.of(AtomicBooleanSerializer.class, AtomicIntegerSerializer.class, AtomicLongSerializer.class, + FileSerializer.class, ClassSerializer.class, TokenBufferSerializer.class).forEach((serializer) -> { + TypeHint typeHint = hints.getTypeHint(serializer); + assertThat(typeHint).withFailMessage(() -> "No hints found for serializer " + serializer) + .isNotNull(); + Set memberCategories = typeHint.getMemberCategories(); + assertThat(memberCategories).containsExactly(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS); + }); } private ReflectionHints registerHints() {