Skip to content

Commit

Permalink
Merge pull request #33671 from geoand/#33647
Browse files Browse the repository at this point in the history
Mark test failure in time for callbacks to know about it
  • Loading branch information
geoand authored May 29, 2023
2 parents 3212b8a + 711336d commit 462755f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ public void testCallbackContextIsFailed() {
assertTrue(TestContextCheckerBeforeEachCallback.CONTEXT.getTestStatus().isTestFailed());
}

@Test
@Order(6)
public void testCallbackContextIsNotFailedAgain() {
assertTrue(TestContextCheckerBeforeEachCallback.CONTEXT.getTestStatus().isTestFailed());
}

@Target({ METHOD })
@Retention(RUNTIME)
public @interface TestAnnotation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler;
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
import org.junit.jupiter.api.extension.TestWatcher;

public abstract class AbstractQuarkusTestWithContextExtension extends AbstractTestWithCallbacksExtension
implements LifecycleMethodExecutionExceptionHandler, TestWatcher {
implements TestExecutionExceptionHandler, LifecycleMethodExecutionExceptionHandler, TestWatcher {

public static final String IO_QUARKUS_TESTING_TYPE = "io.quarkus.testing.type";

@Override
public void handleTestExecutionException(ExtensionContext context, Throwable throwable) throws Throwable {
markTestAsFailed(context, throwable);

throw throwable;
}

@Override
public void handleAfterAllMethodExecutionException(ExtensionContext context, Throwable throwable) throws Throwable {
markTestAsFailed(context, throwable);
Expand Down

0 comments on commit 462755f

Please sign in to comment.