DefaultPathResolver implements PathResolver { public String pathFor(ResourceMethod method) { String format = resolver.getAcceptFormat(); String suffix = ""; if (format != null && !format.equals("html")) { suffix = '.' + format; } String name = method.getResource().getType().getSimpleName(); String folderName = extractControllerFromName(name); return getPrefix() + folderName + '/' + method.getMethod().getName() + suffix + '.' +getExtension(); } DefaultPathResolver(FormatResolver resolver); String pathFor(ResourceMethod method);  }
@Test public void shouldUseResourceTypeAndMethodNameToResolveJsp(){ when(formatResolver.getAcceptFormat()).thenReturn(null); String result = resolver.pathFor(method); assertThat(result, is("/WEB-INF/jsp/dog/bark.jsp")); }
@Test public void shouldUseTheFormatIfSupplied() throws NoSuchMethodException { when(formatResolver.getAcceptFormat()).thenReturn("json"); String result = resolver.pathFor(method); assertThat(result, is("/WEB-INF/jsp/dog/bark.json.jsp")); }
@Test public void shouldIgnoreHtmlFormat() throws NoSuchMethodException { when(formatResolver.getAcceptFormat()).thenReturn("html"); String result = resolver.pathFor(method); assertThat(result, is("/WEB-INF/jsp/dog/bark.jsp")); }