AEM 6.5 Java 11 upgrade: Junit tests with MockSlingHttpServletRequest adaptTo() failing

bytecode0110

18-03-2020

On upgrading from Java 8 to Java 11, all unit tests with request.adaptTo() have started failing with NPE - code snippet below. We are using Junit 4 and mockito-core version 2.25.1. Please advice on this issue. Do we need to add additional dependencies when upgrading to Java 11? TIA.

 

import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
Resource resource = resolver.getResource("/abc-component/main_abc_component");
request.setResource(resource);
Abc abc = request.adaptTo(Abc.class);

 

Accepted Solutions (0)

Answers (0)