How to verify that a specific method was not called using Mockito?

Even more meaningful :

import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;

// ...

verify(dependency, never()).someMethod();

The documentation of this feature is there ยง4 “Verifying exact number of invocations / at least x / never”, and the never javadoc is here.

Leave a Comment