use of org.apache.sling.servlethelpers.MockSlingHttpServletRequest in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class CoreFormHandlingServletTest method testDoPost.
@Test
public void testDoPost() throws Exception {
SlingHttpServletRequest request = new MockSlingHttpServletRequest(context.resourceResolver());
SlingHttpServletResponse response = new MockSlingHttpServletResponse();
servlet.doPost(request, response);
verify(formsHandlingServletHelper).doPost(request, response);
}
use of org.apache.sling.servlethelpers.MockSlingHttpServletRequest in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DefaultPathProcessorTest method testSanitizeInternalLik.
@Test
void testSanitizeInternalLik() {
DefaultPathProcessor underTest = context.registerService(new DefaultPathProcessor());
String path = "#internal";
MockSlingHttpServletRequest request = context.request();
assertEquals(path, underTest.sanitize(path, request));
path = PATH + path;
assertEquals(path, underTest.sanitize(path, request));
path = "?request=value";
assertEquals(path, underTest.sanitize(path, request));
path = PATH + path;
assertEquals(path, underTest.sanitize(path, request));
path = "/some space#internal";
assertEquals("/some%20space#internal", underTest.sanitize(path, request));
}
use of org.apache.sling.servlethelpers.MockSlingHttpServletRequest in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class DefaultPathProcessorTest method testMappingWithException.
@Test
void testMappingWithException() {
ResourceResolver resourceResolver = mock(ResourceResolver.class);
when(resourceResolver.map(any(SlingHttpServletRequest.class), anyString())).thenThrow(IllegalStateException.class);
MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(resourceResolver);
DefaultPathProcessor underTest = localContext.registerService(new DefaultPathProcessor());
assertEquals(PATH, underTest.map(PATH, request));
}
Aggregations