Register runtime hints for skipped exceptions in the TestContext framework
Closes gh-31479
This commit is contained in:
@@ -205,6 +205,7 @@ public class TestContextAotGenerator {
|
||||
MultiValueMap<ClassName, Class<?>> initializerClassMappings = processAheadOfTime(mergedConfigMappings);
|
||||
generateAotTestContextInitializerMappings(initializerClassMappings);
|
||||
generateAotTestAttributeMappings();
|
||||
registerSkippedExceptionTypes();
|
||||
}
|
||||
finally {
|
||||
resetAotFactories();
|
||||
@@ -422,6 +423,20 @@ public class TestContextAotGenerator {
|
||||
this.runtimeHints.reflection().registerType(type, INVOKE_DECLARED_CONSTRUCTORS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register hints for skipped exception types loaded via reflection in
|
||||
* {@link org.springframework.test.context.TestContextManager}.
|
||||
* @since 6.1.2
|
||||
*/
|
||||
private void registerSkippedExceptionTypes() {
|
||||
Stream.of(
|
||||
"org.opentest4j.TestAbortedException",
|
||||
"org.junit.AssumptionViolatedException",
|
||||
"org.testng.SkipException")
|
||||
.map(TypeReference::of)
|
||||
.forEach(this.runtimeHints.reflection()::registerType);
|
||||
}
|
||||
|
||||
private static boolean getFailOnErrorFlag() {
|
||||
String failOnError = SpringProperties.getProperty(FAIL_ON_ERROR_PROPERTY_NAME);
|
||||
if (StringUtils.hasText(failOnError)) {
|
||||
|
||||
Reference in New Issue
Block a user