Mockito.verify()
Verify interactions with your mock
// Verify interactions
Mockito.verify(mock, Mockito.times(1)).sampleMethod();
// Verify, method should not be invoked even once
Mockito.verify(mock, Mockito.never()).sampleMethod2();// Verify, we did not miss any interaction in out test
// If will fail if there are any interaction
// and we did not wrote a verification assertion in our test
Mockito.verifyNoMoreInteractions(otherMockedClass);// Verify, our mock did not have any methods called in peice of code we were testing
Mockito.verifyNoInteractions(otherMockedClass);Last updated