diff --git a/integration-tests/injectmock/src/test/java/io/quarkus/it/mockbean/WithSpiesTest.java b/integration-tests/injectmock/src/test/java/io/quarkus/it/mockbean/WithSpiesTest.java index 6392513c0440c..8129e91cfd03b 100644 --- a/integration-tests/injectmock/src/test/java/io/quarkus/it/mockbean/WithSpiesTest.java +++ b/integration-tests/injectmock/src/test/java/io/quarkus/it/mockbean/WithSpiesTest.java @@ -6,6 +6,7 @@ import jakarta.inject.Named; import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -80,4 +81,20 @@ public void testOverrideDummy() { .statusCode(200) .body(is("1/2")); } + + @Nested + class WithNested { + @Test + @DisplayName("Verify default Greeting values are returned from Spied objects") + public void testGreet() { + given() + .when().get("/greeting") + .then() + .statusCode(200) + .body(is("HELLO")); + Mockito.verify(capitalizerService, Mockito.times(1)).capitalize(Mockito.eq("hello")); + Mockito.verify(messageService, Mockito.times(1)).getMessage(); + Mockito.verify(suffixService, Mockito.times(1)).getSuffix(); + } + } } diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java index a0b2ac6fc2c8b..73c7260696caf 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java @@ -765,9 +765,6 @@ private void initTestState(ExtensionContext extensionContext, QuarkusTestExtensi } invokeAfterConstructCallbacks(Object.class, actualTestInstance); - for (Object outerInstance : outerInstances) { - invokeAfterConstructCallbacks(Object.class, outerInstance); - } } catch (Exception e) { throw new TestInstantiationException("Failed to create test instance", e instanceof InvocationTargetException ? e.getCause() : e);