From 40647bdaf6b279e5be774dc3a004b2ae93a60b46 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 31 Aug 2022 13:07:47 +0200 Subject: [PATCH] Register hints for test execution event annotations in the TCF See gh-29044 --- .../test/context/aot/hint/TestContextRuntimeHints.java | 9 +++++++++ .../test/context/aot/TestContextAotGeneratorTests.java | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/hint/TestContextRuntimeHints.java b/spring-test/src/main/java/org/springframework/test/context/aot/hint/TestContextRuntimeHints.java index 0598b760cde..73d862c0205 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/hint/TestContextRuntimeHints.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/hint/TestContextRuntimeHints.java @@ -99,6 +99,15 @@ class TestContextRuntimeHints implements RuntimeHintsRegistrar { // Application Events org.springframework.test.context.event.RecordApplicationEvents.class, + // Test execution events + org.springframework.test.context.event.annotation.AfterTestClass.class, + org.springframework.test.context.event.annotation.AfterTestExecution.class, + org.springframework.test.context.event.annotation.AfterTestMethod.class, + org.springframework.test.context.event.annotation.BeforeTestClass.class, + org.springframework.test.context.event.annotation.BeforeTestExecution.class, + org.springframework.test.context.event.annotation.BeforeTestMethod.class, + org.springframework.test.context.event.annotation.PrepareTestInstance.class, + // JUnit Jupiter org.springframework.test.context.junit.jupiter.EnabledIf.class, org.springframework.test.context.junit.jupiter.DisabledIf.class, diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java index 9f1bfbc1639..148fc58f4a1 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java @@ -153,6 +153,15 @@ class TestContextAotGeneratorTests extends AbstractAotTests { // Application Events org.springframework.test.context.event.RecordApplicationEvents.class, + // Test execution events + org.springframework.test.context.event.annotation.AfterTestClass.class, + org.springframework.test.context.event.annotation.AfterTestExecution.class, + org.springframework.test.context.event.annotation.AfterTestMethod.class, + org.springframework.test.context.event.annotation.BeforeTestClass.class, + org.springframework.test.context.event.annotation.BeforeTestExecution.class, + org.springframework.test.context.event.annotation.BeforeTestMethod.class, + org.springframework.test.context.event.annotation.PrepareTestInstance.class, + // JUnit Jupiter org.springframework.test.context.junit.jupiter.EnabledIf.class, org.springframework.test.context.junit.jupiter.DisabledIf.class,