From aeb4d7543301337e6c36bffa0e205107d4f163c6 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 12 Oct 2022 18:01:39 +0300 Subject: [PATCH] Provide a hint for when @QuarkusTest and @QuarkusIntegrationTest are mixed Closes: #28526 Co-authored-by: Falko Modler --- .../main/java/io/quarkus/test/junit/IntegrationTestUtil.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java index 052854625f6be..f3aa07dc40270 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java @@ -108,6 +108,11 @@ static void doProcessTestInstance(Object testInstance, ExtensionContext context) ExtensionContext.Store store = root.getStore(ExtensionContext.Namespace.GLOBAL); QuarkusTestExtensionState state = store.get(QuarkusTestExtensionState.class.getName(), QuarkusTestExtensionState.class); + Object testResourceManager = state.testResourceManager; + if (!(testResourceManager instanceof TestResourceManager)) { + throw new RuntimeException( + "An unexpected situation occurred while trying to instantiate the testing infrastructure. Have you perhaps mixed @QuarkusTest and @QuarkusIntegrationTest in the same test run?"); + } ((TestResourceManager) state.testResourceManager).inject(testInstance); }