From 8371983bab2947673a113d09531cc9d288601c94 Mon Sep 17 00:00:00 2001 From: John OHara Date: Fri, 24 Feb 2023 11:26:44 +0000 Subject: [PATCH] Fix afterEach callback for integration tests --- .../test/junit/AbstractTestWithCallbacksExtension.java | 8 ++++++-- .../test/junit/QuarkusIntegrationTestExtension.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractTestWithCallbacksExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractTestWithCallbacksExtension.java index f9b6d75c5c72d..2717fe0fa4a40 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractTestWithCallbacksExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractTestWithCallbacksExtension.java @@ -80,14 +80,18 @@ protected void invokeAfterEachCallbacks(QuarkusTestMethodContext testMethodConte invokeAfterEachCallbacks(QuarkusTestMethodContext.class, testMethodContext); } - protected boolean isAfterAllCallbacksEmpty() { - return afterAllCallbacks == null || afterAllCallbacks.isEmpty(); + protected boolean isAfterEachCallbacksEmpty() { + return afterEachCallbacks == null || afterEachCallbacks.isEmpty(); } protected void invokeAfterEachCallbacks(Class clazz, Object classInstance) throws Exception { invokeCallbacks(afterEachCallbacks, "afterEach", clazz, classInstance); } + protected boolean isAfterAllCallbacksEmpty() { + return afterAllCallbacks == null || afterAllCallbacks.isEmpty(); + } + protected void invokeAfterAllCallbacks(QuarkusTestContext testContext) throws Exception { invokeAfterAllCallbacks(QuarkusTestContext.class, testContext); } diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusIntegrationTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusIntegrationTestExtension.java index eae6f1471528a..a9e7a071ddc6d 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusIntegrationTestExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusIntegrationTestExtension.java @@ -82,7 +82,7 @@ public void afterTestExecution(ExtensionContext context) throws Exception { @Override public void afterEach(ExtensionContext context) throws Exception { if (!failedBoot) { - if (!isAfterAllCallbacksEmpty()) { + if (!isAfterEachCallbacksEmpty()) { invokeAfterEachCallbacks(createQuarkusTestMethodContext(context)); }