diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/main/Launch.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/main/Launch.java index 1acdae4956edf..351d9e456cd64 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/main/Launch.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/main/Launch.java @@ -4,6 +4,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.junit.jupiter.api.BeforeEach; /** * Annotation for {@link QuarkusMainTest} and {@link QuarkusMainIntegrationTest} that is used to launch command line @@ -11,6 +12,11 @@ * The annotation is meant to be used on test methods only. * * See also {@link LaunchResult} and {@link QuarkusMainLauncher} + * + * IMPORTANT: This annotation should not be used together test setup methods annotated with {@link BeforeEach} + * as the latter will be executed after the application is launched (which is almost certainly not the desired behavior). + * If such methods are needed for tests, users are encouraged to use {@link QuarkusMainLauncher} and launch the application + * in the test method. */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME)