The mocking of non-interface beans not working using the latest micronautVersion 1.3.2 and micronaut-test-junit5:1.1.5. Could this be a reoccurance of https://github.com/micronaut-projects/micronaut-test/issues/20 which was fixed in 1.1?
To see the problem in action please look at the example project: https://github.com/ericathedev/test-kt. It uses Micronaut, Kotlin and JUnit5.
Running ClassWithInjectedFileTest#inject mock classToInject returns
expected: <mock> but was: <exampleMethodReturn>
org.opentest4j.AssertionFailedError: expected: <mock> but was: <exampleMethodReturn>
When mocking a class with an interface the test works, see ClassWithInjectedFileTest#inject mock classToInjectWithInterface.
Thank you in advance!
Hello everybody,
I can confirm the bug. Using an interface instead of a non-interface bean @MockBean is working.
Regards
Simon
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
We have experienced the same. Is there any plan to fix? Thanks
micronaut-projects/micronaut-test#20 was in fact incorrectly closed
Test seems to have passed on the CI?
It didn't run on CI as far as I can tell because I didn't create a PR.
They are running now: https://github.com/micronaut-projects/micronaut-test/pull/264
Most helpful comment
We have experienced the same. Is there any plan to fix? Thanks