use of org.springframework.ide.vscode.boot.java.links.VSCodeSourceLinks in project sts4 by spring-projects.
the class VSCodeSourceLinksTest method testJarUrl.
@Test
public void testJarUrl() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("empty-boot-15-web-app");
Optional<String> url = new VSCodeSourceLinks(null).sourceLinkUrlForFQName(project, "org.springframework.boot.autoconfigure.SpringBootApplication");
assertTrue(url.isPresent());
String headerPart = url.get().substring(0, url.get().indexOf('?'));
assertEquals("jdt://contents/spring-boot-autoconfigure-1.5.8.RELEASE.jar/org.springframework.boot.autoconfigure/SpringBootApplication.class", headerPart);
String positionPart = url.get().substring(url.get().lastIndexOf('#'));
assertEquals("#55,19", positionPart);
}
use of org.springframework.ide.vscode.boot.java.links.VSCodeSourceLinks in project sts4 by spring-projects.
the class VSCodeSourceLinksTest method testJavaSourceUrl.
@Test
public void testJavaSourceUrl() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("empty-boot-15-web-app");
Optional<String> url = new VSCodeSourceLinks(null).sourceLinkUrlForFQName(project, "com.example.EmptyBoot15WebAppApplication");
assertTrue(url.isPresent());
Path projectPath = Paths.get(project.pom().getParent());
URI uri = URI.create(url.get());
// Use File to get rid of the fragment parts of the URL. The URL may have fragments that indicate line and column numbers
uri = new File(uri.getPath()).toURI();
Path relativePath = projectPath.relativize(Paths.get(uri));
assertEquals(Paths.get("src/main/java/com/example/EmptyBoot15WebAppApplication.java"), relativePath);
String positionPart = url.get().substring(url.get().lastIndexOf('#'));
assertEquals("#7,14", positionPart);
}
use of org.springframework.ide.vscode.boot.java.links.VSCodeSourceLinks in project sts4 by spring-projects.
the class VSCodeSourceLinksTest method testJarUrlInnerType.
@Test
public void testJarUrlInnerType() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("empty-boot-15-web-app");
Optional<String> url = new VSCodeSourceLinks(null).sourceLinkUrlForFQName(project, "org.springframework.web.client.RestTemplate$AcceptHeaderRequestCallback");
assertTrue(url.isPresent());
String headerPart = url.get().substring(0, url.get().indexOf('?'));
assertEquals("jdt://contents/spring-web-4.3.12.RELEASE.jar/org.springframework.web.client/RestTemplate$AcceptHeaderRequestCallback.class", headerPart);
String positionPart = url.get().substring(url.get().lastIndexOf('#'));
assertEquals("#747,16", positionPart);
}
Aggregations