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
One of the two tests in InnerTests will fail because the mock will have been called more times than expected as it has not been reset between the two tests. I think this part of the problem was introduced in 65d2191. With a local fix for that in place, the failure still occurs. Looking in the debugger, this is because there are two instances of the action mock, one that has been injected into the tests and one that's being reset by MockitoResetTestExecutionListener.
The text was updated successfully, but these errors were encountered:
sbrannen
changed the title
Resetting of a @MockitoBean does not work when combined with @Nested@MockitoBean reset and MockitoSession management do not work with @Nested tests
Oct 11, 2024
This has been fixed on main and will be available in upcoming 6.2 snapshots.
Please let us know if that addresses your issues.
With a local fix for that in place, the failure still occurs. Looking in the debugger, this is because there are two instances of the action mock, one that has been injected into the tests and one that's being reset by MockitoResetTestExecutionListener.
That appears to be a different bug in the Spring TestContext Framework.
If you annotate InheritedNestedTestConfigurationTests with @ContextConfiguration it should now run against 6.2 snapshots.
I will address that @ContextConfiguration (default @Configuration class detection) issue separately.
Affects: 6.2.0-SNAPSHOT
The following reproduces the problem:
One of the two tests in
InnerTests
will fail because the mock will have been called more times than expected as it has not been reset between the two tests. I think this part of the problem was introduced in 65d2191. With a local fix for that in place, the failure still occurs. Looking in the debugger, this is because there are two instances of theaction
mock, one that has been injected into the tests and one that's being reset byMockitoResetTestExecutionListener
.The text was updated successfully, but these errors were encountered: