fxi missing contextPath for ForwardingPushStateDispatchers

This commit is contained in:
Sebastian Sdorra
2018-09-06 14:41:48 +02:00
parent fdd17b2998
commit f9a8d903b7
2 changed files with 16 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ public class ForwardingPushStateDispatcherTest {
@Test
public void testDispatch() throws ServletException, IOException {
when(request.getContextPath()).thenReturn("");
when(request.getRequestDispatcher("/index.html")).thenReturn(requestDispatcher);
dispatcher.dispatch(request, response, "/something");
@@ -40,8 +41,19 @@ public class ForwardingPushStateDispatcherTest {
verify(requestDispatcher).forward(request, response);
}
@Test
public void testDispatchWithContextPath() throws ServletException, IOException {
when(request.getContextPath()).thenReturn("/scm");
when(request.getRequestDispatcher("/scm/index.html")).thenReturn(requestDispatcher);
dispatcher.dispatch(request, response, "/something");
verify(requestDispatcher).forward(request, response);
}
@Test(expected = IOException.class)
public void testWrapServletException() throws ServletException, IOException {
when(request.getContextPath()).thenReturn("");
when(request.getRequestDispatcher("/index.html")).thenReturn(requestDispatcher);
doThrow(ServletException.class).when(requestDispatcher).forward(request, response);