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
If a @MicronautTest test and its injected dependencies are within a nested class, the dependencies are injected when the test in the nested class runs.
Actual Behaviour
The dependencies are not injected, leading to the following error: kotlin.UninitializedPropertyAccessException: lateinit property has not been initialized
Steps To Reproduce
Reproduction steps are available in the README of the example application below, but generally:
Create a test class that uses the @MicronautTest annotation
Create a nested inner class (with the @nested annotation) containing dependencies injected using the @Inject annotation
Create a test within the inner class that uses the injected dependencies.
The test will fail, but will pass if you move everything outside of the nested inner class.
Expected Behavior
If a @MicronautTest test and its injected dependencies are within a nested class, the dependencies are injected when the test in the nested class runs.
Actual Behaviour
The dependencies are not injected, leading to the following error:
kotlin.UninitializedPropertyAccessException: lateinit property has not been initialized
Steps To Reproduce
Reproduction steps are available in the README of the example application below, but generally:
Environment Information
Example Application
https://github.com/cainecridland/micronaut-nested-test-injection-problem-example
Version
4.4.0
The text was updated successfully, but these errors were encountered: