From 803b336354d630385c60d959d30d40feb154c488 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 29 Sep 2010 13:31:53 +0000 Subject: [PATCH] fixed Portlet UnavailableException tests (SPR-7542) --- .../ComplexPortletApplicationContext.java | 2 +- .../web/portlet/DispatcherPortletTests.java | 16 ++++++++-------- .../Portlet20AnnotationControllerTests.java | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java b/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java index dec4b9e1cf3..8bffa583ad6 100644 --- a/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java +++ b/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java @@ -159,7 +159,7 @@ public class ComplexPortletApplicationContext extends StaticPortletApplicationCo pvs.add("exceptionMappings", "java.lang.IllegalAccessException=failed-illegalaccess\n" + "PortletRequestBindingException=failed-binding\n" + - "UnavailableException=failed-unavailable"); + "NoHandlerFoundException=failed-unavailable"); pvs.add("defaultErrorView", "failed-default-1"); registerSingleton("exceptionResolver", SimpleMappingExceptionResolver.class, pvs); diff --git a/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java b/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java index fde1bcf01be..299ff54f6fe 100644 --- a/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java +++ b/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java @@ -136,7 +136,7 @@ public class DispatcherPortletTests extends TestCase { simpleDispatcherPortlet.processAction(request, response); String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER); assertNotNull(exceptionParam); - assertTrue(exceptionParam.startsWith(UnavailableException.class.getName())); + assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName())); } public void testSimpleFormViewNoBindOnNewForm() throws Exception { @@ -246,7 +246,7 @@ public class DispatcherPortletTests extends TestCase { simpleDispatcherPortlet.doDispatch(request, response); fail("Should have thrown UnavailableException"); } - catch (UnavailableException ex) { + catch (NoHandlerFoundException ex) { // expected } } @@ -279,7 +279,7 @@ public class DispatcherPortletTests extends TestCase { complexDispatcherPortlet.processAction(request, response); String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER); assertNotNull(exceptionParam); - assertTrue(exceptionParam.startsWith(UnavailableException.class.getName())); + assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName())); } public void testPortletModeParameterMappingInvalidHelpRenderRequest() throws Exception { @@ -289,7 +289,7 @@ public class DispatcherPortletTests extends TestCase { request.setParameter("action", "help3"); complexDispatcherPortlet.doDispatch(request, response); Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE); - assertTrue(model.get("exception").getClass().equals(UnavailableException.class)); + assertTrue(model.get("exception").getClass().equals(NoHandlerFoundException.class)); InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE); assertEquals("failed-unavailable", view.getBeanName()); } @@ -405,7 +405,7 @@ public class DispatcherPortletTests extends TestCase { complexDispatcherPortlet.processAction(request, response); String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER); assertNotNull(exceptionParam); - assertTrue(exceptionParam.startsWith(UnavailableException.class.getName())); + assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName())); } public void testNoDetectAllHandlerMappingsWithParameterRenderRequest() throws Exception { @@ -420,7 +420,7 @@ public class DispatcherPortletTests extends TestCase { complexDispatcherPortlet.doDispatch(request, response); Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE); Exception exception = (Exception) model.get("exception"); - assertTrue(exception.getClass().equals(UnavailableException.class)); + assertTrue(exception.getClass().equals(NoHandlerFoundException.class)); InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE); assertEquals("failed-unavailable", view.getBeanName()); } @@ -900,9 +900,9 @@ public class DispatcherPortletTests extends TestCase { try { simpleDispatcherPortlet.doDispatch(request, response); - fail("should have failed to find a handler and raised an UnavailableException"); + fail("should have failed to find a handler and raised an NoHandlerFoundExceptionException"); } - catch (UnavailableException ex) { + catch (NoHandlerFoundException ex) { // expected } diff --git a/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java b/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java index a53494e6e62..3e9dc25b510 100644 --- a/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java +++ b/org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java @@ -34,7 +34,6 @@ import javax.portlet.PortletSession; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.StateAwareResponse; -import javax.portlet.UnavailableException; import javax.portlet.WindowState; import javax.servlet.http.Cookie; @@ -86,6 +85,7 @@ import org.springframework.web.context.request.WebRequest; import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.portlet.DispatcherPortlet; import org.springframework.web.portlet.ModelAndView; +import org.springframework.web.portlet.NoHandlerFoundException; import org.springframework.web.portlet.bind.annotation.ActionMapping; import org.springframework.web.portlet.bind.annotation.EventMapping; import org.springframework.web.portlet.bind.annotation.RenderMapping; @@ -419,9 +419,9 @@ public class Portlet20AnnotationControllerTests { MockRenderResponse response = new MockRenderResponse(); try { portlet.render(request, response); - fail("Should have thrown UnavailableException"); + fail("Should have thrown NoHandlerFoundException"); } - catch (UnavailableException ex) { + catch (NoHandlerFoundException ex) { // expected }