complexDispatcherPortlet.doDispatch(request, response);
assertEquals("locale-ok", response.getContentAsString());
}
public void testIncorrectLocaleInLocalContextHolder() throws Exception {
MockRenderRequest request = new MockRenderRequest();
MockRenderResponse response = new MockRenderResponse();
request.setParameter("myParam", "contextLocaleChecker");
request.addPreferredLocale(Locale.ENGLISH);
complexDispatcherPortlet.doDispatch(request, response);
Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
Exception exception = (Exception) model.get("exception");
assertTrue(exception.getClass().equals(PortletException.class));
assertEquals("Incorrect Locale in LocaleContextHolder", exception.getMessage());
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
assertEquals("failed-default-1", view.getBeanName());
}