In Mockito, is there a way to verify that there are no more interactions on any mock I have created?
For example:
public void test()
{
...
TestObject obj = mock(TestObject);
myClass.test();
verifyNoMoreInteractionsWithMocks(); <-------
}
Is there such a method?
Since verifyNoMoreInteractions take an array of object we have to find a way to get all the created mocks.
You can create this class
and then use it in your test :
or with annotations :
It works but it adds a dependency on mockito internal.