@Test public void computeResourcePathInvalidUri() { BuildFailureException bfe = assertThrows(BuildFailureException.class, () -> markupToEclipseHelp.computeResourcePath(":not valid", "")); assertTrue(bfe.getMessage().contains("\":not valid\" is not a valid URI")); }
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; }
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; } }
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; }  }
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(); }
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();  }