Package org.springframework.web.portlet

Examples of org.springframework.web.portlet.ModelAndView


  }

  public void testNullExceptionMappings() {
    exceptionResolver.setExceptionMappings(null);
    exceptionResolver.setDefaultErrorView(DEFAULT_VIEW);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertEquals(DEFAULT_VIEW, mav.getViewName());
  }
View Full Code Here


  }

  public void testDefaultNoRenderWhenMinimized() {
    exceptionResolver.setDefaultErrorView(DEFAULT_VIEW);
    request.setWindowState(WindowState.MINIMIZED);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertNull("Should not render when WindowState is MINIMIZED", mav);
  }
View Full Code Here

  public void testDoRenderWhenMinimized() {
    exceptionResolver.setDefaultErrorView(DEFAULT_VIEW);
    exceptionResolver.setRenderWhenMinimized(true);
    request.setWindowState(WindowState.MINIMIZED);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertNotNull("ModelAndView should not be null", mav);
    assertEquals(DEFAULT_VIEW, mav.getViewName());
  }
View Full Code Here

  public void testSimpleExceptionMapping() {
    Properties props = new Properties();
    props.setProperty("Exception", "error");
    exceptionResolver.setWarnLogCategory("HANDLER_EXCEPTION");
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertEquals("error", mav.getViewName());
  }
View Full Code Here

  public void testExactExceptionMappingWithHandlerSpecified() {
    Properties props = new Properties();
    props.setProperty("java.lang.Exception", "error");
    exceptionResolver.setMappedHandlers(Collections.singleton(handler1));
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertEquals("error", mav.getViewName());
  }
View Full Code Here

  public void testExactExceptionMappingWithHandlerClassSpecified() {
    Properties props = new Properties();
    props.setProperty("java.lang.Exception", "error");
    exceptionResolver.setMappedHandlerClasses(new Class[] {String.class});
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertEquals("error", mav.getViewName());
  }
View Full Code Here

  public void testExactExceptionMappingWithHandlerInterfaceSpecified() {
    Properties props = new Properties();
    props.setProperty("java.lang.Exception", "error");
    exceptionResolver.setMappedHandlerClasses(new Class[] {Comparable.class});
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertEquals("error", mav.getViewName());
  }
View Full Code Here

  public void testSimpleExceptionMappingWithHandlerSpecifiedButWrongHandler() {
    Properties props = new Properties();
    props.setProperty("Exception", "error");
    exceptionResolver.setMappedHandlers(Collections.singleton(handler1));
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler2, genericException);
    assertNull("Handler not mapped - ModelAndView should be null", mav);
  }
View Full Code Here

  public void testSimpleExceptionMappingWithHandlerSpecifiedButWrongHandlerClass() {
    Properties props = new Properties();
    props.setProperty("Exception", "error");
    exceptionResolver.setMappedHandlerClasses(new Class[] {String.class});
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler2, genericException);
    assertNull("Handler not mapped - ModelAndView should be null", mav);
  }
View Full Code Here

  public void testMissingExceptionInMapping() {
    Properties props = new Properties();
    props.setProperty("SomeFooThrowable", "error");
    exceptionResolver.setWarnLogCategory("HANDLER_EXCEPTION");
    exceptionResolver.setExceptionMappings(props);
    ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException);
    assertNull("Exception not mapped - ModelAndView should be null", mav);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.portlet.ModelAndView

Copyright © 2018 www.massapicom. 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.