### Question:
MarkupToEclipseHelpMojo extends AbstractMojo { protected String computeResourcePath(String resourcePath, String relativePath) { if (resourcePath.startsWith("/") || isAbsoluteUri(resourcePath)) { return resourcePath; } String path = resourcePath; String prefix = relativePath.replaceAll("[^\\\\/]+", "..").replace('\\', '/'); if (prefix.length() > 0) { if (!resourcePath.startsWith("/")) { prefix += '/'; } path = prefix + resourcePath; } return path; }  void execute();  }### Answer:
@Test public void computeResourcePath() { assertEquals("styles/main.css", markupToEclipseHelp.computeResourcePath("styles/main.css", "")); assertEquals("../styles/main.css", markupToEclipseHelp.computeResourcePath("styles/main.css", "one")); assertEquals("../../styles/main.css", markupToEclipseHelp.computeResourcePath("styles/main.css", "one/two")); assertEquals("/styles/main.css", markupToEclipseHelp.computeResourcePath("/styles/main.css", "prefix")); assertEquals("http: markupToEclipseHelp.computeResourcePath("http: }
@Test public void computeResourcePathInvalidUri() { BuildFailureException bfe = assertThrows(BuildFailureException.class, () -> markupToEclipseHelp.computeResourcePath(":not valid", "")); assertTrue(bfe.getMessage().contains("\":not valid\" is not a valid URI")); }
@Test public void computeResourcePathInvalidUri() { thrown.expect(BuildFailureException.class); thrown.expectMessage("\":not valid\" is not a valid URI"); markupToEclipseHelp.computeResourcePath(":not valid", ""); }