Skip to content
Advertisement

Is there an equivalent of verifyZeroInteractions() for verifying an exact number of interaction with a mock object?

I would like to verify there were exactly x interactions with might db mock object. Is there something similar to the ‘verifyZeroInteractions()’ method for doing so?

Advertisement

Answer

Mockito.verify(MOCKED_OBJ, Mockito.times(number)).YOUR_METHOD_CALL();

Mockito.verify(MOCKED_OBJ, Mockito.atLeast(number)).YOUR_METHOD_CALL();

More information is here

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement