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
Minor, but I noticed today when I accidentally passed in a non-mock to an InOrder.verify call that it warned me that it can only verify mocks that were passed in during creation of InOrder. While correct, it seems like perhaps using the standard "non-mock" warning would be more helpful as it has better hinting for this situation. In particular, this seems like it would be useful to newer users of the API who might have a hard time figuring out what they did wrong.
Argument passed to verify() should be a mock but is null!
Examples of correct verifications:
verify(mock).someMethod();
verify(mock, times(10)).someMethod();
verify(mock, atLeastOnce()).someMethod();
not: verify(mock.someMethod());
Also, if you use @Mock annotation don't miss initMocks()
InOrder can only verify mocks that were passed in during creation of InOrder.
For example:
InOrder inOrder = inOrder(mockOne);
inOrder.verify(mockOne).doStuff();
Desired behavior
Note that the current InOrder message does not give the hint of how to fix the non-mock that was passed in. Using the standard non-mock warning in this case seems like a more helpful response. Alternatively, that the hinting could be included in the InOrder output when a non-mock is used.
The text was updated successfully, but these errors were encountered:
… / specific
*Adds NullInsteadOfMockException and NotAMockException checks to Inorder.verify() *before* checking if mocks were passed in during creation of Inorder
Minor, but I noticed today when I accidentally passed in a non-mock to an
InOrder.verify
call that it warned me that it can only verify mocks that were passed in during creation ofInOrder
. While correct, it seems like perhaps using the standard "non-mock" warning would be more helpful as it has better hinting for this situation. In particular, this seems like it would be useful to newer users of the API who might have a hard time figuring out what they did wrong.Mockito.verify
Output
inOrder.verify
Output
Desired behavior
Note that the current
InOrder
message does not give the hint of how to fix the non-mock that was passed in. Using the standard non-mock warning in this case seems like a more helpful response. Alternatively, that the hinting could be included in theInOrder
output when a non-mock is used.The text was updated successfully, but these errors were encountered: