I should correct myself a bit... By putting the if on the class level I need to add every method used by the class, and also add all these methods to the mock object. It should be added to the method level where doStuff() is called.