Register runtime hints for skipped exceptions in the TestContext framework
Closes gh-31479
This commit is contained in:
@@ -158,6 +158,12 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
|
||||
assertReflectionRegistered(runtimeHints, AotTestContextInitializersCodeGenerator.GENERATED_MAPPINGS_CLASS_NAME, INVOKE_PUBLIC_METHODS);
|
||||
assertReflectionRegistered(runtimeHints, AotTestAttributesCodeGenerator.GENERATED_ATTRIBUTES_CLASS_NAME, INVOKE_PUBLIC_METHODS);
|
||||
|
||||
Stream.of(
|
||||
"org.opentest4j.TestAbortedException",
|
||||
"org.junit.AssumptionViolatedException",
|
||||
"org.testng.SkipException"
|
||||
).forEach(type -> assertReflectionRegistered(runtimeHints, type));
|
||||
|
||||
Stream.of(
|
||||
org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.class,
|
||||
org.springframework.test.context.support.DefaultBootstrapContext.class
|
||||
@@ -239,6 +245,12 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
|
||||
.accepts(runtimeHints);
|
||||
}
|
||||
|
||||
private static void assertReflectionRegistered(RuntimeHints runtimeHints, String type) {
|
||||
assertThat(reflection().onType(TypeReference.of(type)))
|
||||
.as("Reflection hint for %s", type)
|
||||
.accepts(runtimeHints);
|
||||
}
|
||||
|
||||
private static void assertReflectionRegistered(RuntimeHints runtimeHints, String type, MemberCategory memberCategory) {
|
||||
assertThat(reflection().onType(TypeReference.of(type)).withMemberCategory(memberCategory))
|
||||
.as("Reflection hint for %s with category %s", type, memberCategory)
|
||||
|
||||
Reference in New Issue
Block a user