如何模拟一个非静态,非final的void方法。方法的签名如下。我使用的是PowerMockito。
当调用methodName时,我希望什么也不做。以上代码无法工作,它显示无法解析methodName。
public class Name{
public void methodName{
...
...
}
}
@RunWith(PowerMockRunner.class)
@PrepareForTest({Name.class})
public class TestClass{
@Test
public void testMethodName(){
PowerMockito.doNothing().when(Name.class, methodName);
//some when calls after this and assert later on
}
当调用methodName时,我希望什么也不做。以上代码无法工作,它显示无法解析methodName。