我正在尝试执行简单的测试用例,但是收到错误。以下是我的测试用例:
@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()或者这个()
对此有任何解决方案吗?
答案 0 :(得分:3)
当我们使用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>