added missing resource information for automatically wired constructor live hovers

This commit is contained in:
Martin Lippert
2017-11-06 13:47:35 +01:00
parent 8d40558071
commit d906c2fddb
6 changed files with 27 additions and 16 deletions

View File

@@ -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"
);
}

View File

@@ -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()

View File

@@ -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`"
);
}

View File

@@ -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();
}
}