如何在Mockito中进行间谍检查时不检查方法调用

时间:2014-03-28 06:21:59

标签: unit-testing mocking mockito junit4 spy

我正在尝试测试最后一个要验证的方法的调用。我不想执行它。

//First I spied the test class.
TestClass testClass =  spy(new TestClass());

//I did something like
doNothing().when(testClass ).method1(parameter);
...
//but in the following line I found the actual method1 is invoked and exceptions are thrown
verify(testClass ).method1(parameter);

如何检查方法1调用而不执行间谍?

谢谢!

0 个答案:

没有答案