【发布时间】:2014-02-02 20:51:07
【问题描述】:
我们有一些测试在 JDK 1.6 上运行良好。我们现在正在迁移到 JDK 1.7。这些测试在 Eclipse 中运行良好。当我们从 Ant 构建中运行这些测试时,我们会看到如下错误:
junit.framework.TestListener: addError(<testmethodname>, loader constraint violation:
when resolving overridden method
"com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Lorg/w3c/dom/Node;)Ljava/lang/Object;"
the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class,
com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl, and its superclass loader (instance of <bootloader>),
have different Class objects for the type
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Lorg/w3c/dom/Node;)Ljava/lang/Object; used in the signature)
当我们第一次看到这个时,我们使用的是 PowerMockito 1.5。我只是尝试升级到 1.5.4 和所有相关依赖项,结果没有任何变化。
这显示了我们正在使用的类注释:
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({ "javax.xml.*", "org.xml.sax.*" })
@PrepareForTest(<classundertest>.class)
public class <classundertest>Test extends MockServiceBase {
这里可能有什么问题?
【问题讨论】:
标签: java eclipse java-7 mockito powermock