Polishing
This commit is contained in:
@@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
* Tests for {@link RegisterReflectionReflectiveProcessor}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.2
|
||||
*/
|
||||
class RegisterReflectionReflectiveProcessorTests {
|
||||
|
||||
@@ -47,6 +48,7 @@ class RegisterReflectionReflectiveProcessorTests {
|
||||
|
||||
private final RuntimeHints hints = new RuntimeHints();
|
||||
|
||||
|
||||
@Nested
|
||||
class AnnotatedTypeTests {
|
||||
|
||||
@@ -73,6 +75,7 @@ class RegisterReflectionReflectiveProcessorTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Nested
|
||||
class AnnotatedMethodTests {
|
||||
|
||||
@@ -88,11 +91,12 @@ class RegisterReflectionReflectiveProcessorTests {
|
||||
Method method = RegistrationMethodWithoutTarget.class.getDeclaredMethod("doReflection");
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> registerReflectionHints(method))
|
||||
.withMessageContaining("At least one class must be specified, could not detect target from '")
|
||||
.withMessageContaining("At least one class must be specified")
|
||||
.withMessageContaining(method.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void assertBasicTypeHint(Class<?> type, List<String> methodNames, List<MemberCategory> memberCategories) {
|
||||
TypeHint typeHint = getTypeHint(type);
|
||||
assertThat(typeHint.methods()).map(ExecutableHint::getName).hasSameElementsAs(methodNames);
|
||||
@@ -120,31 +124,32 @@ class RegisterReflectionReflectiveProcessorTests {
|
||||
this.processor.registerReflectionHints(this.hints.reflection(), annotatedElement);
|
||||
}
|
||||
|
||||
|
||||
@RegisterReflection(classes = SimplePojo.class, memberCategories = MemberCategory.INVOKE_PUBLIC_METHODS)
|
||||
static class RegistrationSimple {}
|
||||
static class RegistrationSimple {
|
||||
}
|
||||
|
||||
|
||||
@RegisterReflection(classes = { Number.class, Double.class },
|
||||
classNames = { "java.lang.Integer", "java.lang.Float" }, memberCategories = MemberCategory.INVOKE_PUBLIC_METHODS)
|
||||
static class RegistrationMultipleTargets {
|
||||
|
||||
}
|
||||
|
||||
|
||||
static class RegistrationMethod {
|
||||
|
||||
@RegisterReflection(classes = SimplePojo.class, memberCategories = MemberCategory.INVOKE_DECLARED_METHODS)
|
||||
private void doReflection() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static class RegistrationMethodWithoutTarget {
|
||||
|
||||
@RegisterReflection(memberCategories = MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)
|
||||
private void doReflection() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -171,6 +176,7 @@ class RegisterReflectionReflectiveProcessorTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RegisterReflection(memberCategories = MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)
|
||||
static class AnnotatedSimplePojo {
|
||||
|
||||
@@ -179,8 +185,6 @@ class RegisterReflectionReflectiveProcessorTests {
|
||||
AnnotatedSimplePojo(String test) {
|
||||
this.test = test;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user