SonarQubeTaskUtils { static String extractURI(String pathToClass, String path) { String uri = null; if (path.startsWith("jar:file:")) { int bang = path.indexOf('!'); uri = path.substring(4, bang); } else if (path.startsWith("file:")) { int tail = path.indexOf(pathToClass); uri = path.substring(0, tail); } return uri; } private  SonarQubeTaskUtils(); static URL getJarPath(); static int getAntLoggerLever(Project project); static String getTaskVersion();  }
@Test public void shouldExtractURI() { assertThat(SonarQubeTaskUtils.extractURI(null, "jar:file:/temp/foo.jar!bar")).isEqualTo("file:/temp/foo.jar"); assertThat(SonarQubeTaskUtils.extractURI("/mypackage/myClass.class", "file:/temp/foo.jar/mypackage/myClass.class")).isEqualTo("file:/temp/foo.jar"); assertThat(SonarQubeTaskUtils.extractURI(null, "/temp/foo.jar")).isNull(); }