AEM 6.3 JUnit test AemContext issue
Hi,
I have updated my project from AEM6.2 to AEM6.3, and almost everything works except for the unit tests using the io.wcm.testing.mock.aem.junit.AemContext.
@Rule
public final AemContext context = new AemContext(ResourceResolverType.JCR_MOCK);
I tried to match the dependencies of the AEM WCM Core project and the one mentioned in the blog here as the issues mentioned there, I'm also experiencing.
I have also tried changing the order of the dependencies, but then NoSuchMethodError is presenting for another class.
Example of the error I'm getting
java.lang.NoSuchMethodError: org.apache.sling.api.resource.ResourceMetadata.setParameterMap(Ljava/util/Map;)V
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResourceFactory.createResource(JcrItemResourceFactory.java:115)
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.getResource(JcrResourceProvider.java:283)
at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.getResource(AuthenticatedResourceProvider.java:135)
at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.getResource(ResourceResolverControl.java:218)
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getAbsoluteResourceInternal(ResourceResolverImpl.java:1055)
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getResourceInternal(ResourceResolverImpl.java:688)
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getResource(ResourceResolverImpl.java:642)
at org.apache.sling.testing.mock.sling.loader.ContentLoader.createResourceHierarchy(ContentLoader.java:195)
at org.apache.sling.testing.mock.sling.loader.ContentLoader.createResourceHierarchy(ContentLoader.java:197)
at org.apache.sling.testing.mock.sling.loader.ContentLoader.json(ContentLoader.java:171)
at org.apache.sling.testing.mock.sling.loader.ContentLoader.json(ContentLoader.java:136)
at nl.valtech.aem.common.seocomponents.components.PaginatorComponentTest.setUp(PaginatorComponentTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
Below a list of properties containing my versions of the dependecies (The names are based on the artifactId)
<!-- DEPENDENCIES -->
<aem.api.version>6.0.0.1</aem.api.version>
<org.apache.felix.scr.version>1.6.0</org.apache.felix.scr.version>
<org.apache.felix.scr.annotations.version>1.9.6</org.apache.felix.scr.annotations.version>
<bndlib.version>1.50.0</bndlib.version>
<org.osgi.core.osgi.version>4.2.0</org.osgi.core.osgi.version>
<org.osgi.core.felix.version>1.4.0</org.osgi.core.felix.version>
<org.osgi.compendium.version>4.2.0</org.osgi.compendium.version>
<slf4j.api.version>1.7.6</slf4j.api.version>
<servlet.api.version>2.4</servlet.api.version>
<jsp.api.version>2.1</jsp.api.version>
<jcr.version>2.0</jcr.version>
<geronimo.atinject.spec.version>1.0</geronimo.atinject.spec.version>
<org.apache.sling.models.api.version>1.3.4</org.apache.sling.models.api.version>
<org.apache.sling.models.impl.version>1.3.0</org.apache.sling.models.impl.version>
<org.apache.sling.jcr.api.version>2.0.4</org.apache.sling.jcr.api.version>
<org.apache.sling.commons.osgi.version>2.2.0</org.apache.sling.commons.osgi.version>
<jackrabbit.core.version>2.4.3</jackrabbit.core.version>
<jackrabbit.jcr.commons.version>2.4.3</jackrabbit.jcr.commons.version>
<org.apache.sling.api.version>2.7.0</org.apache.sling.api.version>
<javax.inject.version>1</javax.inject.version>
<cq.wcm.taglib.version>5.7.4</cq.wcm.taglib.version>
<commons.lang3.version>3.4</commons.lang3.version>
<com.google.code.findbugs.annotations.version>2.0.1</com.google.code.findbugs.annotations.version>
<com.google.code.findbugs.jsr305.version>2.0.0</com.google.code.findbugs.jsr305.version>
<!-- DEPENDENCIES TESTING -->
<junit.version>4.12</junit.version>
<slf4j.simple.version>1.7.6</slf4j.simple.version>
<!--<mockito.all.version>1.10.19</mockito.all.version>-->
<mockito.core.version>1.10.19</mockito.core.version>
<junit.addons.version>1.4</junit.addons.version>
<org.apache.commons.commons.imaging.version>1.0-R1534292</org.apache.commons.commons.imaging.version>
<powermock.api.mockito.version>1.6.4</powermock.api.mockito.version>
<io.wcm.testing.aem.mock.version>2.2.6</io.wcm.testing.aem.mock.version>
<!-- OSGi Framework version -->
<org.osgi.version>6.0.0</org.osgi.version>
<org.apache.felix.framework.version>5.0.0</org.apache.felix.framework.version>
<org.osgi.service.component.annotations.version>1.3.0</org.osgi.service.component.annotations.version>
<org.osgi.service.metatype.annotations.version>1.3.0</org.osgi.service.metatype.annotations.version>
<osgi.annotation.version>6.0.1</osgi.annotation.version>
Anybody an idea what is causing this error?
