Search code examples
javajmockit

How to verify, that no method of a class has been called?


I want to check, that no method of a given class was called. Right now I am doing this by putting into the verification-block a single line for every method like shown in this listing:

new Verifications() {
    {
        myClass.method1();
        times = 0;

        myClass.method2();
        times = 0;
    }
};

The problem is, that if someone adds method3 to MyClass and calls it, my test won't notice that. Is there a more generic way to do this? Something like myClass.*; times = 0;?


Solution

  • With the answer of YoungHobbit in mind I found the answer myself:

    new FullVerifications(myClass) {};
    

    does the trick.