List of usage examples for java.security.acl NotOwnerException NotOwnerException
public NotOwnerException()
From source file:ar.com.zauber.commons.spring.exceptions.StatusSimpleMappingExceptionHandlerTest.java
/** test */ public final void testFoo() { final Properties views = new Properties(); views.put(NotOwnerException.class.getName(), "notowner"); views.put(IllegalArgumentException.class.getName(), "arguments"); views.put(DataAccessResourceFailureException.class.getName(), "data"); final Properties status = new Properties(); status.put("arguments", "400"); status.put("notowner", "403"); status.put("data", "500"); final StatusSimpleMappingExceptionHandler h = new StatusSimpleMappingExceptionHandler(); h.setDefaultStatusCode(200);// w ww.ja va2 s . co m h.setExceptionMappings(views); h.setStatusMappings(status); h.setDefaultErrorView("default"); MockHttpServletResponse response; ModelAndView v; response = new MockHttpServletResponse(); v = h.resolveException(new MockHttpServletRequest(), response, null, new IOException("io!io!")); assertEquals("default", v.getViewName()); assertEquals(200, response.getStatus()); response = new MockHttpServletResponse(); v = h.resolveException(new MockHttpServletRequest(), response, null, new IllegalArgumentException("asdasd")); assertEquals("arguments", v.getViewName()); assertEquals(400, response.getStatus()); response = new MockHttpServletResponse(); v = h.resolveException(new MockHttpServletRequest(), response, null, new NotOwnerException()); assertEquals("notowner", v.getViewName()); assertEquals(403, response.getStatus()); response = new MockHttpServletResponse(); v = h.resolveException(new MockHttpServletRequest(), response, null, new DataAccessResourceFailureException("bla bla")); assertEquals("data", v.getViewName()); assertEquals(500, response.getStatus()); }