我有一些简单的课程用于查看是否可以开始powermock
工作:
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest(Foo.class)
public class FooTest
{
@Test
public void testFoobar(){
Foo test = PowerMock.createPartialMock(Foo.class, "foobar");
PowerMock.replay(test);
}
}
和
public class Foo
{
public String foobar(String aString){
return aString + " blah";
}
}
当我尝试运行这个单元测试时,它告诉我:
java.lang.NoClassDefFoundError: org/easymock/classextension/internal/ClassProxyFactory$MockMethodInterceptor
...
我不知道它为什么这样做。请帮忙。