Skip to content

Instantly share code, notes, and snippets.

@davidjgonzalez
Last active October 24, 2019 13:13
Show Gist options
  • Save davidjgonzalez/acab42b7357aac4fa4b83b28bfc6ffb5 to your computer and use it in GitHub Desktop.
Save davidjgonzalez/acab42b7357aac4fa4b83b28bfc6ffb5 to your computer and use it in GitHub Desktop.
package com.adobe.aem.commons.assetshare.content.renditions.download.impl;
import com.adobe.aem.commons.assetshare.content.renditions.AssetRenditions;
import com.adobe.aem.commons.assetshare.content.renditions.download.AssetRenditionPacker;
import com.adobe.aem.commons.assetshare.content.renditions.impl.AssetRenditionServlet;
import com.adobe.aem.commons.assetshare.content.renditions.impl.AssetRenditionsImpl;
import com.adobe.aem.commons.assetshare.testing.MockAssetModels;
import com.adobe.aem.commons.assetshare.util.ServletHelper;
import com.adobe.aem.commons.assetshare.util.impl.ServletHelperImpl;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import org.apache.sling.models.factory.ModelFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import javax.servlet.Servlet;
import java.util.List;
import static org.junit.Assert.assertEquals;
@ExtendWith({AemContextExtension.class, MockitoExtension.class})
public class AssetRenditionsDownloadServletTest {
private final AemContext ctx = new AemContext();
@Mock
ModelFactory modelFactory;
@Mock
com.adobe.aem.commons.assetshare.content.AssetModel asset1;
@Mock
com.adobe.aem.commons.assetshare.content.AssetModel asset2;
@Before
public void setUp() {
ctx.load().json(getClass().getResourceAsStream("AssetRenditionsDownloadServletTest.json"), "/content");
MockAssetModels.mockModelFactory(ctx, modelFactory, "/content/dam/test-1.png");
MockAssetModels.mockModelFactory(ctx, modelFactory, "/content/dam/test-2.png");
ctx.registerService(AssetRenditionPacker.class, new AssetRenditionZipperImpl());
ctx.registerService(AssetRenditions.class, new AssetRenditionsImpl());
ctx.registerService(ServletHelper.class, new ServletHelperImpl());
ctx.registerService(ModelFactory.class, modelFactory, org.osgi.framework.Constants.SERVICE_RANKING,
Integer.MAX_VALUE);
}
@Test
public void getAssets() {
ctx.registerInjectActivateService(new AssetRenditionsDownloadServlet());
AssetRenditionsDownloadServlet servlet = (AssetRenditionsDownloadServlet) ctx.getService(Servlet.class);
ctx.request().setQueryString("path=/content/dam/test-1.png&path=/content/dam/test-2.png&path=/content/dam/test-3.png");
List<com.adobe.aem.commons.assetshare.content.AssetModel> actual = servlet.getAssets(ctx.request());
assertEquals(2, actual.size());
assertEquals("/content/dam/test-1.png", actual.get(0).getPath());
assertEquals("/content/dam/test-2.png", actual.get(1).getPath());
}
@Test
public void getRenditionNames() {
ctx.registerInjectActivateService(new AssetRenditionServlet());
AssetRenditionsDownloadServlet servlet = (AssetRenditionsDownloadServlet) ctx.getService(Servlet.class);
ctx.currentResource("/content/allowed-rendition-names");
ctx.request().setQueryString("renditionName=one&renditionName=two&renditionName=four");
List<String> actual = servlet.getRenditionNames(ctx.request());
assertEquals(2, actual.size());
assertEquals("one", actual.get(0));
assertEquals("two", actual.get(1));
}
}
/** TEST OUTPUT **/
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Users/dgonzale/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55672:/Users/dgonzale/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Users/dgonzale/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Users/dgonzale/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Users/dgonzale/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/tools.jar:/Users/dgonzale/Code/acs/asset-share-commons/core/target/test-classes:/Users/dgonzale/Code/acs/asset-share-commons/core/target/classes:/Users/dgonzale/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/dgonzale/.m2/repository/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0.jar:/Users/dgonzale/.m2/repository/org/osgi/org.osgi.compendium/4.2.0/org.osgi.compendium-4.2.0.jar:/Users/dgonzale/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/Users/dgonzale/.m2/repository/org/apache/commons/commons-lang3/3.0.1/commons-lang3-3.0.1.jar:/Users/dgonzale/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar:/Users/dgonzale/.m2/repository/commons-codec/commons-codec/1.5/commons-codec-1.5.jar:/Users/dgonzale/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/Users/dgonzale/.m2/repository/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar:/Users/dgonzale/.m2/repository/javax/jcr/jcr/2.0/jcr-2.0.jar:/Users/dgonzale/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/dgonzale/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/dgonzale/.m2/repository/junit-addons/junit-addons/1.4/junit-addons-1.4.jar:/Users/dgonzale/.m2/repository/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar:/Users/dgonzale/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar:/Users/dgonzale/.m2/repository/com/adobe/aem/uber-jar/6.4.0/uber-jar-6.4.0-apis.jar:/Users/dgonzale/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar:/Users/dgonzale/.m2/repository/org/slf4j/slf4j-simple/1.7.6/slf4j-simple-1.7.6.jar:/Users/dgonzale/.m2/repository/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar:/Users/dgonzale/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/dgonzale/.m2/repository/com/adobe/cq/core.wcm.components.core/1.1.0/core.wcm.components.core-1.1.0.jar:/Users/dgonzale/.m2/repository/org/apache/felix/org.apache.felix.http.jetty/3.4.2/org.apache.felix.http.jetty-3.4.2.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-servlet/9.3.15.v20161220/jetty-servlet-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-server/9.3.15.v20161220/jetty-server-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-http/9.3.15.v20161220/jetty-http-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-io/9.3.15.v20161220/jetty-io-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-util/9.3.15.v20161220/jetty-util-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-jmx/9.3.15.v20161220/jetty-jmx-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-security/9.3.15.v20161220/jetty-security-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-webapp/9.3.15.v20161220/jetty-webapp-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/jetty-xml/9.3.15.v20161220/jetty-xml-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.3.15.v20161220/websocket-servlet-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.3.15.v20161220/websocket-api-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.3.15.v20161220/websocket-server-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.3.15.v20161220/websocket-common-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.3.15.v20161220/websocket-client-9.3.15.v20161220.jar:/Users/dgonzale/.m2/repository/org/apache/felix/org.apache.felix.http.api/3.0.0/org.apache.felix.http.api-3.0.0.jar:/Users/dgonzale/.m2/repository/org/apache/felix/org.apache.felix.http.base/3.0.18/org.apache.felix.http.base-3.0.18.jar:/Users/dgonzale/.m2/repository/org/osgi/org.osgi.annotation/6.0.0/org.osgi.annotation-6.0.0.jar:/Users/dgonzale/.m2/repository/org/osgi/org.osgi.service.metatype.annotations/1.3.0/org.osgi.service.metatype.annotations-1.3.0.jar:/Users/dgonzale/.m2/repository/org/osgi/org.osgi.service.component.annotations/1.3.0/org.osgi.service.component.annotations-1.3.0.jar:/Users/dgonzale/.m2/repository/javax/mail/mail/1.5.0-b01/mail-1.5.0-b01.jar:/Users/dgonzale/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/dgonzale/.m2/repository/org/apache/commons/commons-email/1.2/commons-email-1.2.jar:/Users/dgonzale/.m2/repository/com/adobe/acs/acs-aem-commons-bundle/4.2.0/acs-aem-commons-bundle-4.2.0.jar:/Users/dgonzale/.m2/repository/org/mockito/mockito-core/2.28.2/mockito-core-2.28.2.jar:/Users/dgonzale/.m2/repository/net/bytebuddy/byte-buddy/1.9.10/byte-buddy-1.9.10.jar:/Users/dgonzale/.m2/repository/net/bytebuddy/byte-buddy-agent/1.9.10/byte-buddy-agent-1.9.10.jar:/Users/dgonzale/.m2/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/dgonzale/.m2/repository/org/mockito/mockito-junit-jupiter/2.28.2/mockito-junit-jupiter-2.28.2.jar:/Users/dgonzale/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.1.1/junit-jupiter-api-5.1.1.jar:/Users/dgonzale/.m2/repository/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar:/Users/dgonzale/.m2/repository/org/opentest4j/opentest4j/1.0.0/opentest4j-1.0.0.jar:/Users/dgonzale/.m2/repository/org/junit/platform/junit-platform-commons/1.1.1/junit-platform-commons-1.1.1.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.sling-mock.junit4/2.3.16/org.apache.sling.testing.sling-mock.junit4-2.3.16.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.sling-mock.core/2.3.16/org.apache.sling.testing.sling-mock.core-2.3.16.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.osgi-mock.core/2.4.10/org.apache.sling.testing.osgi-mock.core-2.4.10.jar:/Users/dgonzale/.m2/repository/com/google/guava/guava/15.0/guava-15.0.jar:/Users/dgonzale/.m2/repository/org/reflections/reflections/0.9.9/reflections-0.9.9.jar:/Users/dgonzale/.m2/repository/org/javassist/javassist/3.18.2-GA/javassist-3.18.2-GA.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.jcr-mock/1.4.4/org.apache.sling.testing.jcr-mock-1.4.4.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.resourceresolver-mock/1.1.24/org.apache.sling.testing.resourceresolver-mock-1.1.24.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.servlet-helpers/1.2.0/org.apache.sling.servlet-helpers-1.2.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.commons.osgi/2.4.0/org.apache.sling.commons.osgi-2.4.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.models.api/1.2.2/org.apache.sling.models.api-1.2.2.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.models.impl/1.2.2/org.apache.sling.models.impl-1.2.2.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.api/2.11.0/org.apache.sling.api-2.11.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.resourceresolver/1.4.8/org.apache.sling.resourceresolver-1.4.8.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.jcr.api/2.3.0/org.apache.sling.jcr.api-2.3.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.jcr.resource/2.7.4/org.apache.sling.jcr.resource-2.7.4.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.scripting.api/2.1.8/org.apache.sling.scripting.api-2.1.8.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.scripting.core/2.0.36/org.apache.sling.scripting.core-2.0.36.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.commons.mime/2.1.8/org.apache.sling.commons.mime-2.1.8.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.contentparser.api/2.0.0/org.apache.sling.contentparser.api-2.0.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.contentparser.json/2.0.0/org.apache.sling.contentparser.json-2.0.0.jar:/Users/dgonzale/.m2/repository/org/apache/johnzon/johnzon-core/1.0.0/johnzon-core-1.0.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.commons.classloader/1.3.2/org.apache.sling.commons.classloader-1.3.2.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.settings/1.3.8/org.apache.sling.settings-1.3.8.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.i18n/2.4.4/org.apache.sling.i18n-2.4.4.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.adapter/2.1.6/org.apache.sling.adapter-2.1.6.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.resourcebuilder/1.0.4/org.apache.sling.resourcebuilder-1.0.4.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/jackrabbit-api/2.11.3/jackrabbit-api-2.11.3.jar:/Users/dgonzale/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/dgonzale/.m2/repository/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar:/Users/dgonzale/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/dgonzale/.m2/repository/org/apache/geronimo/specs/geronimo-atinject_1.0_spec/1.0/geronimo-atinject_1.0_spec-1.0.jar:/Users/dgonzale/.m2/repository/org/apache/geronimo/specs/geronimo-json_1.1_spec/1.0/geronimo-json_1.1_spec-1.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.osgi-mock.junit4/2.4.10/org.apache.sling.testing.osgi-mock.junit4-2.4.10.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.sling-mock.junit5/2.3.16/org.apache.sling.testing.sling-mock.junit5-2.3.16.jar:/Users/dgonzale/.m2/repository/io/wcm/io.wcm.testing.aem-mock.junit4/2.7.0/io.wcm.testing.aem-mock.junit4-2.7.0.jar:/Users/dgonzale/.m2/repository/io/wcm/io.wcm.testing.aem-mock.core/2.7.0/io.wcm.testing.aem-mock.core-2.7.0.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/jackrabbit-jcr-commons/2.12.1/jackrabbit-jcr-commons-2.12.1.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.serviceusermapper/1.2.2/org.apache.sling.serviceusermapper-1.2.2.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.commons.json/2.0.16/org.apache.sling.commons.json-2.0.16.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/oak-jcr/1.4.1/oak-jcr-1.4.1.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/oak-core/1.4.1/oak-core-1.4.1.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/oak-blob/1.4.1/oak-blob-1.4.1.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/oak-segment/1.4.1/oak-segment-1.4.1.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/oak-commons/1.4.1/oak-commons-1.4.1.jar:/Users/dgonzale/.m2/repository/org/apache/jackrabbit/vault/org.apache.jackrabbit.vault/3.1.18/org.apache.jackrabbit.vault-3.1.18.jar:/Users/dgonzale/.m2/repository/org/apache/commons/commons-imaging/1.0-R1534292/commons-imaging-1.0-R1534292.jar:/Users/dgonzale/.m2/repository/com/day/commons/day-commons-gfx/2.1.28/day-commons-gfx-2.1.28.jar:/Users/dgonzale/.m2/repository/com/day/commons/day-commons-any/2.0.0/day-commons-any-2.0.0.jar:/Users/dgonzale/.m2/repository/com/day/commons/day-commons-text/1.1.3/day-commons-text-1.1.3.jar:/Users/dgonzale/.m2/repository/io/wcm/io.wcm.testing.junit-commons/1.0.4/io.wcm.testing.junit-commons-1.0.4.jar:/Users/dgonzale/.m2/repository/io/wcm/io.wcm.testing.aem-mock.junit5/2.7.0/io.wcm.testing.aem-mock.junit5-2.7.0.jar:/Users/dgonzale/.m2/repository/org/apache/sling/org.apache.sling.testing.logging-mock/2.0.0/org.apache.sling.testing.logging-mock-2.0.0.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.adobe.aem.commons.assetshare.content.renditions.download.impl.AssetRenditionsDownloadServletTest
java.lang.NullPointerException
at io.wcm.testing.mock.aem.context.AemContextImpl.currentPage(AemContextImpl.java:194)
at io.wcm.testing.mock.aem.context.AemContextImpl.currentResource(AemContextImpl.java:179)
at org.apache.sling.testing.mock.sling.context.SlingContextImpl.currentResource(SlingContextImpl.java:393)
at com.adobe.aem.commons.assetshare.testing.MockAssetModels.mockModelFactory(MockAssetModels.java:49)
at com.adobe.aem.commons.assetshare.content.renditions.download.impl.AssetRenditionsDownloadServletTest.setUp(AssetRenditionsDownloadServletTest.java:60)
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.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
java.lang.NullPointerException
at io.wcm.testing.mock.aem.context.AemContextImpl.currentPage(AemContextImpl.java:194)
at io.wcm.testing.mock.aem.context.AemContextImpl.currentResource(AemContextImpl.java:179)
at org.apache.sling.testing.mock.sling.context.SlingContextImpl.currentResource(SlingContextImpl.java:393)
at com.adobe.aem.commons.assetshare.testing.MockAssetModels.mockModelFactory(MockAssetModels.java:49)
at com.adobe.aem.commons.assetshare.content.renditions.download.impl.AssetRenditionsDownloadServletTest.setUp(AssetRenditionsDownloadServletTest.java:60)
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.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Process finished with exit code 255
/** Dependencies from pom.xml **/
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
<version>2.3.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock.junit5</artifactId>
<version>2.3.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit4</artifactId>
<version>2.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<version>2.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.logging-mock</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
/** Dependencies from core/pom.xml **/
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock.junit5</artifactId>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit4</artifactId>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.logging-mock</artifactId>
</dependency>
</dependencies>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment