samedi 28 février 2015

Mockito - check if ANY method was called on an object(object was accessed)

I want to write a test that passes a mock object A into an object under test B and checks if ANY of the methods of A were called. To give some context, class B is designed to manipulate A in a specific way, based on a set of parameters, and under certain conditions it shouldn't do anything to it at all. So my goal is to test that scenario. I know how to test whether a specific method was called or not:



verify(A, never()).myMethod();


But I can't find a way to make sure that NONE of the methods A has were called. Is there a way to do this?


Aucun commentaire:

Enregistrer un commentaire