Package org.mojavemvc.exception

Examples of org.mojavemvc.exception.ErrorHandler.handleError()


        AppProperties properties = mock(AppProperties.class);
        when(properties.getProperty(DefaultJSPErrorHandler.JSP_ERROR_FILE))
            .thenReturn(errorJsp);

        ErrorHandler errorHandler = new DefaultJSPErrorHandler();
        View view = errorHandler.handleError(null, properties);

        assertTrue(view instanceof JSP);
        JSP jspView = (JSP) view;
        assertEquals(errorJsp, jspView.getJSPName());
    }
View Full Code Here


   
    @Test
    public void handleError_NullException() throws Exception {

        ErrorHandler errorHandler = new DefaultErrorHandler();
        View view = errorHandler.handleError(null, properties);

        assertTrue(view instanceof PlainText);
        PlainText stackTrace = (PlainText) view;
        assertEquals("", stackTrace.toString());
    }
View Full Code Here

    public void handleError_WithException() throws Exception {

        Exception e = new Exception("testing");
       
        ErrorHandler errorHandler = new DefaultErrorHandler();
        View view = errorHandler.handleError(e, properties);

        assertTrue(view instanceof PlainText);
        PlainText stackTrace = (PlainText) view;
        assertTrue(stackTrace.toString().startsWith("java.lang.Exception: testing"));
    }
View Full Code Here

            view.render(req, res, properties);

        } catch (Throwable e) {

            logger.error("error processing request: ", e);
            view = errorHandler.handleError(e, properties);
            if (view != null) {
                /*
                 * we're not catching any exceptions thrown from rendering the
                 * error view
                 */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.