mercredi 28 octobre 2015

Java unit test check if method is invoked without executing it

I have to test a method which invokes two void methods. I just want to check if the two void methods are invoked or not, but the method must be stubbed.

How do I do it? I tried to implement it using Mockito doThrow method, but not success.

doThrow(new RuntimeException()).when(mockedClass).methodName();

Wanted but not invoked: error

How do I solve my problem?

Aucun commentaire:

Enregistrer un commentaire