We are trying to test the behavior of an action with Mockito. The verification code looks like this:
final Type1 mock = mock(Type1.class); new SomeAction<Type1>(mock).actionPerformed(null); verify(mock).someMethod();
The actionPerformed method only contains a call to someMethod for the object provided in the Type1 constructor. However, Mockito complains that the expected method call did not happen; instead, another method call occurred. But the string representation of the two calls printed by Mockito is exactly the same!
Any explanation what is going on?
Update: ErrorMessage from Mockito
Argument(s) are different! Wanted: type1.someMethod(); -> at xxx Actual invocation has different arguments: type1.someMethod(); -> at xxx
java testing mockito
Jens schauder
source share