Skip to content

Commit 803b336

Browse files
committed
fixed Portlet UnavailableException tests (SPR-7542)
1 parent 4c154d3 commit 803b336

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void refresh() throws BeansException {
159159
pvs.add("exceptionMappings",
160160
"java.lang.IllegalAccessException=failed-illegalaccess\n" +
161161
"PortletRequestBindingException=failed-binding\n" +
162-
"UnavailableException=failed-unavailable");
162+
"NoHandlerFoundException=failed-unavailable");
163163
pvs.add("defaultErrorView", "failed-default-1");
164164
registerSingleton("exceptionResolver", SimpleMappingExceptionResolver.class, pvs);
165165

org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void testSimpleInvalidActionRequest() throws Exception {
136136
simpleDispatcherPortlet.processAction(request, response);
137137
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
138138
assertNotNull(exceptionParam);
139-
assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
139+
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
140140
}
141141

142142
public void testSimpleFormViewNoBindOnNewForm() throws Exception {
@@ -246,7 +246,7 @@ public void testSimpleInvalidRenderRequest() throws Exception {
246246
simpleDispatcherPortlet.doDispatch(request, response);
247247
fail("Should have thrown UnavailableException");
248248
}
249-
catch (UnavailableException ex) {
249+
catch (NoHandlerFoundException ex) {
250250
// expected
251251
}
252252
}
@@ -279,7 +279,7 @@ public void testPortletModeParameterMappingInvalidHelpActionRequest() throws Exc
279279
complexDispatcherPortlet.processAction(request, response);
280280
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
281281
assertNotNull(exceptionParam);
282-
assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
282+
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
283283
}
284284

285285
public void testPortletModeParameterMappingInvalidHelpRenderRequest() throws Exception {
@@ -289,7 +289,7 @@ public void testPortletModeParameterMappingInvalidHelpRenderRequest() throws Exc
289289
request.setParameter("action", "help3");
290290
complexDispatcherPortlet.doDispatch(request, response);
291291
Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
292-
assertTrue(model.get("exception").getClass().equals(UnavailableException.class));
292+
assertTrue(model.get("exception").getClass().equals(NoHandlerFoundException.class));
293293
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
294294
assertEquals("failed-unavailable", view.getBeanName());
295295
}
@@ -405,7 +405,7 @@ public void testNoDetectAllHandlerMappingsWithPortletModeActionRequest() throws
405405
complexDispatcherPortlet.processAction(request, response);
406406
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
407407
assertNotNull(exceptionParam);
408-
assertTrue(exceptionParam.startsWith(UnavailableException.class.getName()));
408+
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
409409
}
410410

411411
public void testNoDetectAllHandlerMappingsWithParameterRenderRequest() throws Exception {
@@ -420,7 +420,7 @@ public void testNoDetectAllHandlerMappingsWithParameterRenderRequest() throws Ex
420420
complexDispatcherPortlet.doDispatch(request, response);
421421
Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
422422
Exception exception = (Exception) model.get("exception");
423-
assertTrue(exception.getClass().equals(UnavailableException.class));
423+
assertTrue(exception.getClass().equals(NoHandlerFoundException.class));
424424
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
425425
assertEquals("failed-unavailable", view.getBeanName());
426426
}
@@ -900,9 +900,9 @@ public void testInvalidRenderRequestWithExistingThreadLocalRequestContext() thro
900900

901901
try {
902902
simpleDispatcherPortlet.doDispatch(request, response);
903-
fail("should have failed to find a handler and raised an UnavailableException");
903+
fail("should have failed to find a handler and raised an NoHandlerFoundExceptionException");
904904
}
905-
catch (UnavailableException ex) {
905+
catch (NoHandlerFoundException ex) {
906906
// expected
907907
}
908908

org.springframework.web.portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import javax.portlet.RenderRequest;
3535
import javax.portlet.RenderResponse;
3636
import javax.portlet.StateAwareResponse;
37-
import javax.portlet.UnavailableException;
3837
import javax.portlet.WindowState;
3938
import javax.servlet.http.Cookie;
4039

@@ -86,6 +85,7 @@
8685
import org.springframework.web.context.support.GenericWebApplicationContext;
8786
import org.springframework.web.portlet.DispatcherPortlet;
8887
import org.springframework.web.portlet.ModelAndView;
88+
import org.springframework.web.portlet.NoHandlerFoundException;
8989
import org.springframework.web.portlet.bind.annotation.ActionMapping;
9090
import org.springframework.web.portlet.bind.annotation.EventMapping;
9191
import org.springframework.web.portlet.bind.annotation.RenderMapping;
@@ -419,9 +419,9 @@ protected ApplicationContext createPortletApplicationContext(ApplicationContext
419419
MockRenderResponse response = new MockRenderResponse();
420420
try {
421421
portlet.render(request, response);
422-
fail("Should have thrown UnavailableException");
422+
fail("Should have thrown NoHandlerFoundException");
423423
}
424-
catch (UnavailableException ex) {
424+
catch (NoHandlerFoundException ex) {
425425
// expected
426426
}
427427

0 commit comments

Comments
 (0)