@ -19,7 +19,6 @@ package org.springframework.aot.hint.predicate;
import java.lang.reflect.Constructor ;
import java.lang.reflect.Constructor ;
import java.util.Collections ;
import java.util.Collections ;
import java.util.List ;
import java.util.function.Predicate ;
import java.util.function.Predicate ;
import org.junit.jupiter.api.BeforeAll ;
import org.junit.jupiter.api.BeforeAll ;
@ -66,41 +65,44 @@ class ReflectionHintsPredicatesTests {
@Test
@Test
void reflectionOnClassShouldMatchIntrospection ( ) {
void reflectionOnClassShouldMatchIntrospection ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > { } ) ;
} ) ;
assertPredicateMatches ( reflection . onType ( SampleClass . class ) ) ;
assertPredicateMatches ( reflection . onType ( SampleClass . class ) ) ;
}
}
@Test
@Test
void reflectionOnTypeReferenceShouldMatchIntrospection ( ) {
void reflectionOnTypeReferenceShouldMatchIntrospection ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > { } ) ;
} ) ;
assertPredicateMatches ( reflection . onType ( TypeReference . of ( SampleClass . class ) ) ) ;
assertPredicateMatches ( reflection . onType ( TypeReference . of ( SampleClass . class ) ) ) ;
}
}
@Test
@Test
void reflectionOnDifferentClassShouldNotMatchIntrospection ( ) {
void reflectionOnDifferentClassShouldNotMatchIntrospection ( ) {
runtimeHints . reflection ( ) . registerType ( Integer . class , builder - > {
runtimeHints . reflection ( ) . registerType ( Integer . class , builder - > { } ) ;
} ) ;
assertPredicateDoesNotMatch ( reflection . onType ( TypeReference . of ( SampleClass . class ) ) ) ;
assertPredicateDoesNotMatch ( reflection . onType ( TypeReference . of ( SampleClass . class ) ) ) ;
}
}
@Test
@Test
void typeWithMemberCategoryFailsWithNullCategory ( ) {
void typeWithMemberCategoryFailsWithNullCategory ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - >
assertThatIllegalArgumentException ( ) . isThrownBy ( ( ) - > reflection . onType ( SampleClass . class ) . withMemberCategory ( null ) ) ;
builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
assertThatIllegalArgumentException ( ) . isThrownBy ( ( ) - >
reflection . onType ( SampleClass . class ) . withMemberCategory ( null ) ) ;
}
}
@Test
@Test
void typeWithMemberCategoryMatchesCategory ( ) {
void typeWithMemberCategoryMatchesCategory ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class ,
assertPredicateMatches ( reflection . onType ( SampleClass . class ) . withMemberCategory ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
assertPredicateMatches ( reflection . onType ( SampleClass . class )
. withMemberCategory ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
}
}
@Test
@Test
void typeWithMemberCategoryDoesNotMatchOtherCategory ( ) {
void typeWithMemberCategoryDoesNotMatchOtherCategory ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class ,
assertPredicateDoesNotMatch ( reflection . onType ( SampleClass . class ) . withMemberCategory ( MemberCategory . INVOKE_PUBLIC_METHODS ) ) ;
builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
assertPredicateDoesNotMatch ( reflection . onType ( SampleClass . class )
. withMemberCategory ( MemberCategory . INVOKE_PUBLIC_METHODS ) ) ;
}
}
@Test
@Test
@ -120,20 +122,26 @@ class ReflectionHintsPredicatesTests {
@Test
@Test
void typeWithAnyMemberCategoryFailsWithNullCategories ( ) {
void typeWithAnyMemberCategoryFailsWithNullCategories ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - >
assertThatIllegalArgumentException ( ) . isThrownBy ( ( ) - > reflection . onType ( SampleClass . class ) . withAnyMemberCategory ( new MemberCategory [ 0 ] ) ) ;
builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
assertThatIllegalArgumentException ( ) . isThrownBy ( ( ) - >
reflection . onType ( SampleClass . class ) . withAnyMemberCategory ( new MemberCategory [ 0 ] ) ) ;
}
}
@Test
@Test
void typeWithAnyMemberCategoryMatchesCategory ( ) {
void typeWithAnyMemberCategoryMatchesCategory ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS , MemberCategory . INVOKE_PUBLIC_METHODS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class ,
assertPredicateMatches ( reflection . onType ( SampleClass . class ) . withAnyMemberCategory ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS , MemberCategory . INVOKE_PUBLIC_METHODS ) ) ;
assertPredicateMatches ( reflection . onType ( SampleClass . class )
. withAnyMemberCategory ( MemberCategory . INTROSPECT_PUBLIC_METHODS ) ) ;
}
}
@Test
@Test
void typeWithAnyMemberCategoryDoesNotMatchOtherCategory ( ) {
void typeWithAnyMemberCategoryDoesNotMatchOtherCategory ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS , MemberCategory . INVOKE_PUBLIC_METHODS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class ,
assertPredicateDoesNotMatch ( reflection . onType ( SampleClass . class ) . withAnyMemberCategory ( MemberCategory . INVOKE_DECLARED_METHODS ) ) ;
builder - > builder . withMembers ( MemberCategory . INTROSPECT_PUBLIC_METHODS , MemberCategory . INVOKE_PUBLIC_METHODS ) ) ;
assertPredicateDoesNotMatch ( reflection . onType ( SampleClass . class )
. withAnyMemberCategory ( MemberCategory . INVOKE_DECLARED_METHODS ) ) ;
}
}
}
}
@ -148,140 +156,157 @@ class ReflectionHintsPredicatesTests {
@Test
@Test
void constructorIntrospectionMatchesConstructorHint ( ) {
void constructorIntrospectionMatchesConstructorHint ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withConstructor ( Collections . emptyList ( ) , constructorHint - > {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
} ) ) ;
typeHint . withConstructor ( Collections . emptyList ( ) , constructorHint - > { } ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void constructorIntrospectionMatchesIntrospectPublicConstructors ( ) {
void constructorIntrospectionMatchesIntrospectPublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void constructorIntrospectionMatchesInvokePublicConstructors ( ) {
void constructorIntrospectionMatchesInvokePublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void constructorIntrospectionMatchesIntrospectDeclaredConstructors ( ) {
void constructorIntrospectionMatchesIntrospectDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void constructorIntrospectionMatchesInvokeDeclaredConstructors ( ) {
void constructorIntrospectionMatchesInvokeDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void constructorInvocationDoesNotMatchConstructorHint ( ) {
void constructorInvocationDoesNotMatchConstructorHint ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withConstructor ( Collections . emptyList ( ) , constructorHint - > {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint .
} ) ) ;
withConstructor ( Collections . emptyList ( ) , constructorHint - > { } ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void constructorInvocationMatchesConstructorInvocationHint ( ) {
void constructorInvocationMatchesConstructorInvocationHint ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withConstructor ( Collections . emptyList ( ) , constructorHint - > constructorHint . withMode ( ExecutableMode . INVOKE ) ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint .
withConstructor ( Collections . emptyList ( ) , constructorHint - >
constructorHint . withMode ( ExecutableMode . INVOKE ) ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void constructorInvocationDoesNotMatchIntrospectPublicConstructors ( ) {
void constructorInvocationDoesNotMatchIntrospectPublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void constructorInvocationMatchesInvokePublicConstructors ( ) {
void constructorInvocationMatchesInvokePublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void constructorInvocationDoesNotMatchIntrospectDeclaredConstructors ( ) {
void constructorInvocationDoesNotMatchIntrospectDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void constructorInvocationMatchesInvokeDeclaredConstructors ( ) {
void constructorInvocationMatchesInvokeDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( publicConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void privateConstructorIntrospectionMatchesConstructorHint ( ) {
void privateConstructorIntrospectionMatchesConstructorHint ( ) {
List < TypeReference > parameterTypes = Collections . singletonList ( TypeReference . of ( String . class ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withConstructor ( parameterTypes , constructorHint - > {
typeHint . withConstructor ( TypeReference . listOf ( String . class ) , constructorHint - > { } ) ) ;
} ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void privateConstructorIntrospectionDoesNotMatchIntrospectPublicConstructors ( ) {
void privateConstructorIntrospectionDoesNotMatchIntrospectPublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void privateConstructorIntrospectionDoesNotMatchInvokePublicConstructors ( ) {
void privateConstructorIntrospectionDoesNotMatchInvokePublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void privateConstructorIntrospectionMatchesIntrospectDeclaredConstructors ( ) {
void privateConstructorIntrospectionMatchesIntrospectDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void privateConstructorIntrospectionMatchesInvokeDeclaredConstructors ( ) {
void privateConstructorIntrospectionMatchesInvokeDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . introspect ( ) ) ;
}
}
@Test
@Test
void privateConstructorInvocationDoesNotMatchConstructorHint ( ) {
void privateConstructorInvocationDoesNotMatchConstructorHint ( ) {
List < TypeReference > parameterTypes = Collections . singletonList ( TypeReference . of ( String . class ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withConstructor ( parameterTypes , constructorHint - > {
typeHint . withConstructor ( TypeReference . listOf ( String . class ) , constructorHint - > { } ) ) ;
} ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void privateConstructorInvocationMatchesConstructorInvocationHint ( ) {
void privateConstructorInvocationMatchesConstructorInvocationHint ( ) {
List < TypeReference > parameterTypes = Collections . singletonList ( TypeReference . of ( String . class ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withConstructor ( parameterTypes , constructorHint - > constructorHint . withMode ( ExecutableMode . INVOKE ) ) ) ;
typeHint . withConstructor ( TypeReference . listOf ( String . class ) ,
constructorHint - > constructorHint . withMode ( ExecutableMode . INVOKE ) ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void privateConstructorInvocationDoesNotMatchIntrospectPublicConstructors ( ) {
void privateConstructorInvocationDoesNotMatchIntrospectPublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void privateConstructorInvocationDoesNotMatchInvokePublicConstructors ( ) {
void privateConstructorInvocationDoesNotMatchInvokePublicConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_PUBLIC_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void privateConstructorInvocationDoesNotMatchIntrospectDeclaredConstructors ( ) {
void privateConstructorInvocationDoesNotMatchIntrospectDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INTROSPECT_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
assertPredicateDoesNotMatch ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
}
}
@Test
@Test
void privateConstructorInvocationMatchesInvokeDeclaredConstructors ( ) {
void privateConstructorInvocationMatchesInvokeDeclaredConstructors ( ) {
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - > typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
runtimeHints . reflection ( ) . registerType ( SampleClass . class , typeHint - >
typeHint . withMembers ( MemberCategory . INVOKE_DECLARED_CONSTRUCTORS ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
assertPredicateMatches ( reflection . onConstructor ( privateConstructor ) . invoke ( ) ) ;
}
}