### Question:
ResourceLocationReader { public String getResourceLocationFromRequest(final HttpServletRequest request) { String fileName = request.getParameter(LOCATION_PARAM); if (fileName == null) { final String pathInfo = request.getPathInfo(); if (pathInfo != null && pathInfo.startsWith("/") && pathInfo.length() > 1) { fileName = pathInfo.substring(1); } } return fileName; }  String getResourceLocationFromRequest(final HttpServletRequest request); final static String LOCATION_PARAM; }### Answer:
@Test public void should_use_infopath_if_location_param_is_not_defined() throws Exception { when(req.getParameter("location")).thenReturn(null); when(req.getPathInfo()).thenReturn("/bonita.css"); final String resourceLocation = resourceLocationReader.getResourceLocationFromRequest(req); verify(req, times(1)).getPathInfo(); assertThat(resourceLocation).isEqualTo("bonita.css"); }
@Test public void should_not_use_infopath_if_location_param_is_defined() throws Exception { when(req.getParameter("location")).thenReturn("bonita.css"); final String resourceLocation = resourceLocationReader.getResourceLocationFromRequest(req); verify(req, never()).getPathInfo(); assertThat(resourceLocation).isEqualTo("bonita.css"); }