### Question:
Servlet25DispatcherTypeProvider implements DispatcherTypeProvider { @Override public DispatcherType getDispatcherType(ServletRequest request, ServletContext context) { if (request.getAttribute("javax.servlet.forward.request_uri") != null) { return DispatcherType.FORWARD; } if (request.getAttribute("javax.servlet.include.request_uri") != null) { return DispatcherType.INCLUDE; } Throwable throwable = (Throwable) request.getAttribute("javax.servlet.error.exception"); if (throwable != null) { return DispatcherType.ERROR; } return DispatcherType.REQUEST; }  @Override int priority(); @Override DispatcherType getDispatcherType(ServletRequest request, ServletContext context);  }### Answer:
@Test public void testShouldReturnRequestDispatcherTypeForNoAttributes() { HttpServletRequest request = mock(HttpServletRequest.class); DispatcherTypeProvider provider = new Servlet25DispatcherTypeProvider(); DispatcherType dispatcherType = provider.getDispatcherType(request, mock(ServletContext.class)); assertEquals(DispatcherType.REQUEST, dispatcherType); }
@Test public void testShouldReturnIncludeDispatcherTypeWithCorrectAttributeSet() { HttpServletRequest request = mock(HttpServletRequest.class); when(request.getAttribute("javax.servlet.include.request_uri")).thenReturn("/some/url"); DispatcherTypeProvider provider = new Servlet25DispatcherTypeProvider(); DispatcherType dispatcherType = provider.getDispatcherType(request, mock(ServletContext.class)); assertEquals(DispatcherType.INCLUDE, dispatcherType); }
@Test public void testShouldReturnForwardDispatcherTypeWithCorrectAttributeSet() { HttpServletRequest request = mock(HttpServletRequest.class); when(request.getAttribute("javax.servlet.forward.request_uri")).thenReturn("/some/url"); DispatcherTypeProvider provider = new Servlet25DispatcherTypeProvider(); DispatcherType dispatcherType = provider.getDispatcherType(request, mock(ServletContext.class)); assertEquals(DispatcherType.FORWARD, dispatcherType); }