You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a JUnit TestFactory includes an @Inject mock service bean initialisation works properly for normal @BeforeEach and @Test annotated methods, but tests executed with @TestFactory have the mock service uninitialised.
Expected behavior
The @Inject bean is initialized correctly during @TestFactory execution.
Actual behavior
The @Inject mock bean fails to be initialized and is thus null.
QuarkusUnitTest is meant for internal testing of extensions themselves and as we have never had the need to use @TestFactory, we are very unlikely to make this happen.
If someone however wants to work it, the contribution will be very welcome.
Describe the bug
When a JUnit TestFactory includes an
@Inject
mock service bean initialisation works properly for normal@BeforeEach
and@Test
annotated methods, but tests executed with@TestFactory
have the mock service uninitialised.Expected behavior
The
@Inject
bean is initialized correctly during@TestFactory
execution.Actual behavior
The @Inject mock bean fails to be initialized and is thus null.
How to Reproduce?
Output of
uname -a
orver
Linux MattsDevMachine 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "21.0.6" 2025-01-21 OpenJDK Runtime Environment (build 21.0.6+7-Ubuntu-122.04.1) OpenJDK 64-Bit Server VM (build 21.0.6+7-Ubuntu-122.04.1, mixed mode, sharing)
Quarkus version or git rev
aadb627 (HEAD at time of writing)
Build tool (ie. output of
mvnw --version
orgradlew --version
)Quarkus bundled mvnw
Additional information
A similar issue happened in #8004, and was fixed in #8066. I have ported the fix, I can confirm it works, and will be making a PR shortly.
The text was updated successfully, but these errors were encountered: