![](/img/trans.png)
[英]java.lang.VerifyError: Constructor must call super() or this() before return
[英]Mockito.spy VerifyError: Constructor must call super() or this()
我正在尝试执行简单的测试用例,但出现错误。 以下是我的测试案例:
@Rule
public AemContext context = new AemContext();
@Test
public void test() throws Exception {
Resource currentResource = context
.create()
.resource("/content/app/en-us/page", "jcr:title", "Title Page", "width", "5","height","9");
inheritanceValueMap = Mockito.spy(new HierarchyNodeInheritanceValueMap(currentResource));
Assert.assertThat(inheritanceValueMap.getInherited("width", StringUtils.EMPTY), Is.is("5"));
}
我得到的错误是:
java.lang.VerifyError:(类:com / day / cq / commons / ValueMapWrapper,方法:签名:(Lorg / apache / sling / api / resource / ValueMap;)V)构造函数必须调用super()或this()
有什么解决办法吗?
当我们使用以下uber jar依赖项时,通常会出现此问题:
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.2.0</version>
<classifier>obfuscated-apis</classifier>
<scope>provided</scope>
</dependency>
尝试将依赖项分类器更改为apis ,如下所示:
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.2.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.