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
The mockito verify error message isn't accurate when the type of fields are Object and the object to match in mockito.verify() have a type mismatch. In my example I pass in a int 1 and a string 1. But the error message is wrong and only shows int 1 for both wanted and actual.
Run mvn clean test The test will failure. Which is correct. But the error message isn't correct.
Output:
Argument(s) are different! Wanted:
myService.myMethod(MyClass(myValue=1));
-> at com.example.mockitoissue.MyService.myMethod(MockitoissueApplicationTests.java:27)
Actual invocations have different arguments:
myService.myMethod(MyClass(myValue=1));
-> at com.example.mockitoissue.MockitoissueApplicationTests.contextLoads(MockitoissueApplicationTests.java:18)
Wanted should show a string value the number 1 for myValue=1. Instead both are shown as the same.
Clicking in accurately shows the difference being a new line.
Hi,
mockito: 5.10.0
jdk: Java 11
os: Windows 10
The mockito verify error message isn't accurate when the type of fields are Object and the object to match in mockito.verify() have a type mismatch. In my example I pass in a int 1 and a string 1. But the error message is wrong and only shows int 1 for both wanted and actual.
Sample Repo
https://github.com/LoganDev99/mockito-inaccurate-error
Also snippet for searchability.
check that
Note that some configuration are impossible to mock via Mockito
(same as any question on stackoverflow.com)
The text was updated successfully, but these errors were encountered: