### Question:
ResourceRenderer { public List<String> getPathSegments(final String pathInfo) throws UnsupportedEncodingException { final List<String> segments = new ArrayList<>(); if (pathInfo != null) { for (final String segment : pathInfo.split("/")) { if (!segment.isEmpty()) { segments.add(URLDecoder.decode(segment, "UTF-8")); } } } return segments; }  void renderFile(final HttpServletRequest request, final HttpServletResponse response, final File resourceFile, final APISession apiSession); List<String> getPathSegments(final String pathInfo);  }### Answer:
@Test public void getPathSegments_should_return_expected_token_list() throws UnsupportedEncodingException { when(req.getPathInfo()).thenReturn("a/b"); final List<String> tokens = resourceRenderer.getPathSegments("a/b"); assertThat(tokens).hasSize(2).containsExactly("a", "b"); }
@Test public void getPathSegments_should_return_expected_token_list_ondouble_slash() throws UnsupportedEncodingException { when(req.getPathInfo()).thenReturn("a final List<String> tokens = resourceRenderer.getPathSegments("a assertThat(tokens).hasSize(2).containsExactly("a", "b"); }
@Test public void getPathSegments_should_return_expected_token_list_if_no_slash() throws UnsupportedEncodingException { when(req.getPathInfo()).thenReturn("a"); final List<String> tokens = resourceRenderer.getPathSegments("a"); assertThat(tokens).hasSize(1).containsExactly("a"); }