Skip to content

Commit 0ae1c18

Browse files
committed
Fix unit tests
1 parent c3c9ee4 commit 0ae1c18

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/data/GenAotQueryMethodImplProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public List<LocationLink> getLocationLinks(CancelChecker cancelToken, IJavaProje
102102
}
103103

104104
private List<LocationLink> findImplLocations(IJavaProject project, GoToImplParams implParams) {
105-
String genRepoFqn = implParams.repoFqName() + "Impl__Aot";
105+
String genRepoFqn = implParams.repoFqName() + "Impl__AotRepository";
106106
Path relativeGenSourcePath = Paths.get("%s.java".formatted(genRepoFqn.replace('.', '/')));
107107
List<LocationLink> defs = findInSourceFolder(project, relativeGenSourcePath, genRepoFqn, implParams);
108108
return defs.isEmpty() ? findInBuildFolder(project, relativeGenSourcePath, genRepoFqn, implParams) : defs;
@@ -149,7 +149,9 @@ public boolean visit(MethodDeclaration node) {
149149
private List<LocationLink> findInSourceFolder(IJavaProject project, Path relativeGenSourcePath, String genRepoFqn, GoToImplParams params) {
150150
for (File f : IClasspathUtil.getSourceFolders(project.getClasspath()).collect(Collectors.toSet())) {
151151
Path genRepoSourcePath = f.toPath().resolve(relativeGenSourcePath);
152-
return getLocationInGenFile(project, genRepoSourcePath, genRepoFqn, params);
152+
if (Files.exists(relativeGenSourcePath)) {
153+
return getLocationInGenFile(project, genRepoSourcePath, genRepoFqn, params);
154+
}
153155
}
154156
return List.of();
155157
}

headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/data/test/GenAotQueryMethodImplProviderTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ void nonAnnotatedMethod() throws Exception {
7070

7171
LocationLink ll = new LocationLink();
7272
ll.setTargetUri(Paths.get(testProject.getLocationUri())
73-
.resolve("target/spring-aot/main/sources/example/springdata/aot/UserRepositoryImpl__Aot.java").toUri()
73+
.resolve("target/spring-aot/main/sources/example/springdata/aot/UserRepositoryImpl__AotRepository.java").toUri()
7474
.toASCIIString());
7575
ll.setOriginSelectionRange(new Range(new Position(43, 15), new Position(43, 61)));
76-
ll.setTargetRange(new Range(new Position(144, 20), new Position(144, 66)));
77-
ll.setTargetSelectionRange(new Range(new Position(144, 20), new Position(144, 66)));
76+
ll.setTargetRange(new Range(new Position(140, 20), new Position(140, 66)));
77+
ll.setTargetSelectionRange(new Range(new Position(140, 20), new Position(140, 66)));
7878
editor.assertImplementationLinkTargets("findUserByLastnameStartingWith", List.of(ll));
7979
}
8080

@@ -86,11 +86,11 @@ void annotatedMethod() throws Exception {
8686

8787
LocationLink ll = new LocationLink();
8888
ll.setTargetUri(Paths.get(testProject.getLocationUri())
89-
.resolve("target/spring-aot/main/sources/example/springdata/aot/UserRepositoryImpl__Aot.java").toUri()
89+
.resolve("target/spring-aot/main/sources/example/springdata/aot/UserRepositoryImpl__AotRepository.java").toUri()
9090
.toASCIIString());
9191
ll.setOriginSelectionRange(new Range(new Position(54, 15), new Position(54, 45)));
92-
ll.setTargetRange(new Range(new Position(188, 20), new Position(188, 50)));
93-
ll.setTargetSelectionRange(new Range(new Position(188, 20), new Position(188, 50)));
92+
ll.setTargetRange(new Range(new Position(184, 20), new Position(184, 50)));
93+
ll.setTargetSelectionRange(new Range(new Position(184, 20), new Position(184, 50)));
9494
editor.assertImplementationLinkTargets("usersWithUsernamesStartingWith", List.of(ll));
9595
}
9696

0 commit comments

Comments
 (0)