1

我在 java6 上运行 powermock+easymock+testng。它工作得很好,但现在我必须升级到 java7。一切都在分崩离析。我应该怎么做才能纠正它。

我遇到了配置问题,这是由于调用 EasyMock.reset(myObject)

java.lang.NullPointerException
org.easymock.internal.ClassExtensionHelper.getControl(ClassExtensionHelper.java:57)
org.easymock.EasyMock.getControl(EasyMock.java:2068)
org.easymock.EasyMock.reset(EasyMock.java:1983)

旧套罐:

bsh-2.0b4.jar               easymockclassextension-2.4.jar      jcommander-1.5.jar          rmissl.jar
aopalliance-1.0.jar         cglib-nodep-2.2.jar         guice-2.0.jar               objenesis-1.2.jar           testng-5.14.1.jar
asm-3.0.jar             cobertura.jar               jakarta-oro-2.0.8.jar           powermock-easymock-1.4.6-full.jar   velocity-dep-1.4.jar
asm-tree-3.0.jar            easymock-3.0.jar            javassist-3.13.0-GA.jar         reportng-1.1.2.jar

一套新的罐子:

asm-3.0.jar   bsh-2.0b4.jar      cobertura.jar  easymock-3.1.jar       javassist-3.18.0-GA.jar  objenesis-1.2.jar          reportng-1.1.2.jar  snakeyaml-1.6.jar  velocity-dep-1.4.jar
asm-tree-3.0.jar  cglib-nodep-2.2.2.jar  CVS        jakarta-oro-2.0.8.jar  jcommander-1.27.jar  powermock-easymock-1.5.1-full.jar  rmissl.jar          testng-6.8.5.jar
4

1 回答 1

0

您可以尝试将此代码添加到您的班级

@ObjectFactory
public IObjectFactory getObjectFactory(){
    return new org.powermock.modules.testng.PowerMockObjectFactory();
}
于 2013-10-24T08:43:56.303 回答