Polishing

This commit is contained in:
Sam Brannen
2022-06-20 17:03:57 +02:00
parent 04dde03451
commit 1bbc5648f9
7 changed files with 24 additions and 17 deletions

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Tests for {@link ReflectionTypeReference}.
@@ -34,28 +35,24 @@ class ReflectionTypeReferenceTests {
@ParameterizedTest
@MethodSource("reflectionTargetNames")
void typeReferenceFromClasHasSuitableReflectionTargetName(TypeReference typeReference, String binaryName) {
assertThat(typeReference.getName()).isEqualTo(binaryName);
void typeReferenceFromClassHasSuitableReflectionTargetName(Class<?> clazz, String binaryName) {
assertThat(ReflectionTypeReference.of(clazz).getName()).isEqualTo(binaryName);
}
static Stream<Arguments> reflectionTargetNames() {
return Stream.of(
Arguments.of(ReflectionTypeReference.of(int.class), "int"),
Arguments.of(ReflectionTypeReference.of(int[].class), "int[]"),
Arguments.of(ReflectionTypeReference.of(Integer[].class), "java.lang.Integer[]"),
Arguments.of(ReflectionTypeReference.of(Object[].class), "java.lang.Object[]"),
Arguments.of(ReflectionTypeReference.of(StaticInner.class),
"org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticInner"),
Arguments.of(ReflectionTypeReference.of(StaticInner[].class),
"org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticInner[]"),
Arguments.of(ReflectionTypeReference.of(Inner.class),
"org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner"),
Arguments.of(ReflectionTypeReference.of(Inner[].class),
"org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner[]")
arguments(int.class, "int"),
arguments(int[].class, "int[]"),
arguments(Integer[].class, "java.lang.Integer[]"),
arguments(Object[].class, "java.lang.Object[]"),
arguments(StaticNested.class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticNested"),
arguments(StaticNested[].class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticNested[]"),
arguments(Inner.class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner"),
arguments(Inner[].class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner[]")
);
}
static class StaticInner {
static class StaticNested {
}
class Inner {