By default Mockito 5.x use a new MockMaker that is not compatible with any WO subclasses. It is still possible to create mock and spy by specifying the old MockMaker like this:
- Replacing @mock with @mock(mockMaker = MockMakers.SUBCLASS) in field declaration;
- Replacing mock(...) with mock(..., withSettings().mockMaker(MockMakers.SUBCLASS));
- Replacing spy(instance) with instance = mock(InstanceClass.class, withSettings()
.mockMaker(MockMakers.SUBCLASS)
.spiedInstance(instance).defaultAnswer(CALLS_REAL_METHODS));
I suggest to adjust the wounits behaviour when detecting @SPY annotation to specify the old MockMaker and creating a new @EOMock (or WOMock) annotation to help creating compatible mock with the old MockMaker.
By default Mockito 5.x use a new MockMaker that is not compatible with any WO subclasses. It is still possible to create mock and spy by specifying the old MockMaker like this:
.mockMaker(MockMakers.SUBCLASS)
.spiedInstance(instance).defaultAnswer(CALLS_REAL_METHODS));
I suggest to adjust the wounits behaviour when detecting @SPY annotation to specify the old MockMaker and creating a new @EOMock (or WOMock) annotation to help creating compatible mock with the old MockMaker.