1

这就是我正在做的事情:

PowerMockito.mockStatic(Foo.class);
PowerMockito.whenNew(Foo.class).withNoArguments().thenReturn(null);
Foo foo1 = new Foo();
assert foo1 == null; // works fine
//...
// now I want PowerMockito to stop mocking the call
Foo foo2 = new Foo(); 
assert foo2 != null;

我找不到PowerMockito.reset()方法.. 什么是解决方法?

4

1 回答 1

1

尝试

MockRepository.remove(Foo.class);
于 2015-03-02T22:17:46.153 回答