Verifying that an expected method has run in Mockito usually goes something like this:
when(mockFoo.someMethod()).thenReturn(someValue);
// run test
verify(mockFoo, times(n)).someMethod();
Is there any way for me to specify the verification at the time I create the mock. In something like EasyMock I can do:
mockFoo = EasyMock.createMock(Foo.class);
EasyMock.expect(mockFoo.someMethod()).times(n).andReturn(someValue);
// then run test
My use case is that I have a commonly reused test dependency that I'd like to mock (the doesFooMethodAndReturnBar5Times mock), but with Mockito I don't have a way to enforce the verification on it.