Polish RuntimeHintsPredicates
This commit adds a method variant checking that all `MemberCategory` are supported by the `RuntimeHints` for a given type hint. See gh-28555
This commit is contained in:
@@ -98,6 +98,21 @@ class ReflectionHintsPredicatesTests {
|
||||
assertPredicateDoesNotMatch(reflection.onType(SampleClass.class).withMemberCategory(MemberCategory.INVOKE_PUBLIC_METHODS));
|
||||
}
|
||||
|
||||
@Test
|
||||
void typeWithMemberCategoriesMatchesCategories() {
|
||||
runtimeHints.reflection().registerType(SampleClass.class, builder ->
|
||||
builder.withMembers(MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS, MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
assertPredicateMatches(reflection.onType(SampleClass.class)
|
||||
.withMemberCategories(MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS, MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
}
|
||||
|
||||
@Test
|
||||
void typeWithMemberCategoriesDoesNotMatchMissingCategory() {
|
||||
runtimeHints.reflection().registerType(SampleClass.class, builder -> builder.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
assertPredicateDoesNotMatch(reflection.onType(SampleClass.class)
|
||||
.withMemberCategories(MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS, MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
}
|
||||
|
||||
@Test
|
||||
void typeWithAnyMemberCategoryFailsWithNullCategories() {
|
||||
runtimeHints.reflection().registerType(SampleClass.class, builder -> builder.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
|
||||
Reference in New Issue
Block a user