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
In micronaut tests, annotations @BeforeAll and @BeforeEach exhibit counterintuitive behavior.
For @BeforeAll, in a case such as the one below, the method beforeAll in the nested test class is executed before dependency injection is apparently done, which leads to null pointer exception errors because dslContext is always null. Is this expected behavior?
Similarly, in the example below, when using @BeforeEach to initialize parameterized tests using @MethodSource, it seems that the code in the method beforeEach isn't executed before the method getArguments initialized. This leads to a null pointer exception when calling testObject.toString() because testObject is always null. Is this also intended behavior?
Issue description
In micronaut tests, annotations
@BeforeAll
and@BeforeEach
exhibit counterintuitive behavior.For
@BeforeAll
, in a case such as the one below, the methodbeforeAll
in the nested test class is executed before dependency injection is apparently done, which leads to null pointer exception errors because dslContext is always null. Is this expected behavior?Similarly, in the example below, when using
@BeforeEach
to initialize parameterized tests using@MethodSource
, it seems that the code in the methodbeforeEach
isn't executed before the methodgetArguments
initialized. This leads to a null pointer exception when callingtestObject.toString()
because testObject is always null. Is this also intended behavior?If we run similar tests in a spring boot application, no null pointer exception errors are thrown.
For context, I am using:
The text was updated successfully, but these errors were encountered: