当我尝试编译Maven时,出现此错误,有人可以尝试查看如何进行编译吗?
getTimezoneOffset()
这是模拟失败的单元测试:
[INFO] Running com.emc.recoverpoint.kate.script.engine.ScriptShellImplTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.755 s <<< FAILURE! - in com.emc.recoverpoint.kate.script.engine.ScriptShellImplTest
[ERROR] init(com.emc.recoverpoint.kate.script.engine.ScriptShellImplTest) Time elapsed: 0.688 s <<< ERROR!
java.lang.NoSuchMethodError: org.mockito.internal.handler.MockHandlerFactory.create(Lorg/mockito/mock/MockCreationSettings;)Lorg/mockito/internal/InternalMockHandler;
at com.emc.recoverpoint.kate.script.engine.ScriptShellImplTest.setUp(ScriptShellImplTest.java:16)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] ScriptShellImplTest.setUp:16 � NoSuchMethod org.mockito.internal.handler.MockH...
这是模仿单元测试包的pom:
package com.emc.recoverpoint.kate.script.engine;
import com.emc.recoverpoint.kate.configuration.properties.ScenariosUpgradeProperties;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.reflect.Whitebox;
public class ScriptShellImplTest {
private ScriptShellImpl scriptShell;
@Before
public void setUp() throws Exception {
scriptShell = PowerMockito.spy(new ScriptShellImpl());
ScenariosUpgradeProperties scenariosUpgradeProperties = PowerMockito.mock(ScenariosUpgradeProperties.class);
Whitebox.setInternalState(scriptShell, "properties", scenariosUpgradeProperties);
PowerMockito.when(scenariosUpgradeProperties.getActiveScriptPackagePath()).thenReturn("this_is_a_test");
}
@Test
public void init() throws Exception {
// Currently, the test is doing nothing, but it helped me to test my changes
scriptShell.init();
}
}
这是主要的pom:
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
在类似的预览答案中找不到任何解决方案。 在此先感谢:-)