added missing resource information for automatically wired constructor live hovers
This commit is contained in:
@@ -89,11 +89,13 @@ public class AutowiredHoverProviderTest {
|
||||
.add(LiveBean.builder()
|
||||
.id("dependencyA")
|
||||
.type("com.example.DependencyA")
|
||||
.fileResource(harness.getOutputFolder() + "/com/example/DependencyA.class")
|
||||
.build()
|
||||
)
|
||||
.add(LiveBean.builder()
|
||||
.id("dependencyB")
|
||||
.type("com.example.DependencyB")
|
||||
.classpathResource("com/example/DependencyB.class")
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
@@ -128,9 +130,11 @@ public class AutowiredHoverProviderTest {
|
||||
"Bean [id: autowiredClass, type: `com.example.AutowiredClass`] got autowired with:\n" +
|
||||
"\n" +
|
||||
"- Bean: dependencyA \n" +
|
||||
" Type: `com.example.DependencyA`\n" +
|
||||
" Type: `com.example.DependencyA` \n" +
|
||||
" Resource: `com/example/DependencyA.class`\n" +
|
||||
"- Bean: dependencyB \n" +
|
||||
" Type: `com.example.DependencyB`\n"
|
||||
" Type: `com.example.DependencyB` \n" +
|
||||
" Resource: `com/example/DependencyB.class`\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,11 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.livebean.LiveBean;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.livebean.LiveBeansModel;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
|
||||
import org.springframework.ide.vscode.commons.util.text.LanguageId;
|
||||
import org.springframework.ide.vscode.languageserver.testharness.Editor;
|
||||
@@ -223,7 +221,7 @@ public class BeanInjectedIntoHoverProviderTest {
|
||||
|
||||
@Test
|
||||
public void beanWithFileResource() throws Exception {
|
||||
Path of = getOutputFolder();
|
||||
Path of = harness.getOutputFolder();
|
||||
LiveBeansModel beans = LiveBeansModel.builder()
|
||||
.add(LiveBean.builder()
|
||||
.id("fooImplementation")
|
||||
@@ -278,7 +276,6 @@ public class BeanInjectedIntoHoverProviderTest {
|
||||
|
||||
@Test
|
||||
public void beanWithClasspathResource() throws Exception {
|
||||
Path of = getOutputFolder();
|
||||
LiveBeansModel beans = LiveBeansModel.builder()
|
||||
.add(LiveBean.builder()
|
||||
.id("fooImplementation")
|
||||
@@ -331,10 +328,6 @@ public class BeanInjectedIntoHoverProviderTest {
|
||||
);
|
||||
}
|
||||
|
||||
private Path getOutputFolder() {
|
||||
return harness.getProjectFinder().find(null).get().getClasspath().getOutputFolder();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanWithMultipleInjections() throws Exception {
|
||||
LiveBeansModel beans = LiveBeansModel.builder()
|
||||
|
||||
@@ -486,11 +486,13 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
.add(LiveBean.builder()
|
||||
.id("dependencyA")
|
||||
.type("com.example.DependencyA")
|
||||
.fileResource(harness.getOutputFolder() + "/com/example/DependencyA.class")
|
||||
.build()
|
||||
)
|
||||
.add(LiveBean.builder()
|
||||
.id("dependencyB")
|
||||
.type("com.example.DependencyB")
|
||||
.classpathResource("com/example/DependencyB.class")
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
@@ -522,8 +524,12 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
"Bean [id: autowiredClass, type: `com.example.AutowiredClass`] exists but is **Not injected anywhere**\n" +
|
||||
"Bean [id: autowiredClass, type: `com.example.AutowiredClass`] got autowired with:\n" +
|
||||
"\n" +
|
||||
"- Bean [id: dependencyA, type: `com.example.DependencyA`]\n" +
|
||||
"- Bean [id: dependencyB, type: `com.example.DependencyB`]\n"
|
||||
"- Bean: dependencyA \n" +
|
||||
" Type: `com.example.DependencyA` \n" +
|
||||
" Resource: `com/example/DependencyA.class`\n" +
|
||||
"- Bean: dependencyB \n" +
|
||||
" Type: `com.example.DependencyB` \n" +
|
||||
" Resource: `com/example/DependencyB.class`"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.project.harness;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -123,4 +124,10 @@ public class BootLanguageServerHarness extends LanguageServerHarness<BootJavaLan
|
||||
public void useProject(IJavaProject p) throws Exception {
|
||||
indexHarness.useProject(p);
|
||||
}
|
||||
|
||||
public Path getOutputFolder() {
|
||||
return getProjectFinder().find(null).get().getClasspath().getOutputFolder();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user