Search in sources :

Example 1 with ExceptionRenderer

use of com.enonic.xp.web.exception.ExceptionRenderer in project xp by enonic.

the class AdminSiteHandlerTest method setup.

@BeforeEach
public final void setup() throws Exception {
    final ExceptionMapper exceptionMapper = Mockito.mock(ExceptionMapper.class);
    final ExceptionRenderer exceptionRenderer = Mockito.mock(ExceptionRenderer.class);
    this.handler = new AdminSiteHandler();
    this.handler.setExceptionMapper(exceptionMapper);
    this.handler.setExceptionRenderer(exceptionRenderer);
    this.handler.activate(mock(AdminConfig.class, invocation -> invocation.getMethod().getDefaultValue()));
    final HttpServletRequest rawRequest = Mockito.mock(HttpServletRequest.class);
    this.request = new WebRequest();
    this.request.setRawRequest(rawRequest);
    this.response = WebResponse.create().build();
}
Also used : Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) BeforeEach(org.junit.jupiter.api.BeforeEach) WebException(com.enonic.xp.web.WebException) BaseHandlerTest(com.enonic.xp.web.handler.BaseHandlerTest) WebResponse(com.enonic.xp.web.WebResponse) ExceptionMapper(com.enonic.xp.web.exception.ExceptionMapper) WebRequest(com.enonic.xp.web.WebRequest) Test(org.junit.jupiter.api.Test) Mockito(org.mockito.Mockito) HttpServletRequest(javax.servlet.http.HttpServletRequest) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) PortalRequest(com.enonic.xp.portal.PortalRequest) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) HttpStatus(com.enonic.xp.web.HttpStatus) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ExceptionRenderer(com.enonic.xp.web.exception.ExceptionRenderer) Mockito.mock(org.mockito.Mockito.mock) HttpServletRequest(javax.servlet.http.HttpServletRequest) ExceptionMapper(com.enonic.xp.web.exception.ExceptionMapper) WebRequest(com.enonic.xp.web.WebRequest) ExceptionRenderer(com.enonic.xp.web.exception.ExceptionRenderer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

PortalRequest (com.enonic.xp.portal.PortalRequest)1 HttpStatus (com.enonic.xp.web.HttpStatus)1 WebException (com.enonic.xp.web.WebException)1 WebRequest (com.enonic.xp.web.WebRequest)1 WebResponse (com.enonic.xp.web.WebResponse)1 ExceptionMapper (com.enonic.xp.web.exception.ExceptionMapper)1 ExceptionRenderer (com.enonic.xp.web.exception.ExceptionRenderer)1 BaseHandlerTest (com.enonic.xp.web.handler.BaseHandlerTest)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertFalse (org.junit.jupiter.api.Assertions.assertFalse)1 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 Mockito (org.mockito.Mockito)1 Mockito.mock (org.mockito.Mockito.mock)1