As can be seen in the tests introduced in commit 4a0edc59cc599815adfaf58e1da9ba0b18957801, the static factory methods in MockReset
(such as MockReset.before()
and MockReset.after()
) can currently only be applied to beans within the ApplicationContext
if the test class declares at least one field annotated with either @MockitoBean
or @MockitoSpyBean
.
However, as stated in the Javadoc, it should be possible to apply MockReset
:
directly to any mock in the
ApplicationContext
using the static methods in this class.
We therefore need to rework the "enabled" logic in MockitoResetTestExecutionListener
to support that documented use case.