fixed issue with live hover to autowired showing up even without the dependencies being wired successfully

This commit is contained in:
Martin Lippert
2017-11-01 12:06:06 +01:00
parent 71cbda64dd
commit 86f9348775
4 changed files with 94 additions and 63 deletions

View File

@@ -194,4 +194,49 @@ public class AutowiredHoverProviderTest {
editor.assertNoHover("@Autowired");
}
@Test
public void noHoversWhenRunningAppDoesntHaveDependenciesForTheAutowiring() throws Exception {
LiveBeansModel beans = LiveBeansModel.builder()
.add(LiveBean.builder()
.id("autowiredClass")
.type("com.example.AutowiredClass")
.build()
)
.add(LiveBean.builder()
.id("dependencyA")
.type("com.example.DependencyA")
.build()
)
.add(LiveBean.builder()
.id("dependencyB")
.type("com.example.DependencyB")
.build()
)
.build();
mockAppProvider.builder()
.isSpringBootApp(true)
.processId("111")
.processName("the-app")
.beans(beans)
.build();
Editor editor = harness.newEditor(LanguageId.JAVA,
"package com.example;\n" +
"\n" +
"import org.springframework.beans.factory.annotation.Autowired;\n" +
"import org.springframework.stereotype.Component;\n" +
"\n" +
"@Component\n" +
"public class AutowiredClass {\n" +
"\n" +
" @Autowired\n" +
" public AutowiredClass(DependencyA depA, DependencyB depB) {\n" +
" }\n" +
"}\n"
);
editor.assertHighlights("@Component");
editor.assertNoHover("@Autowired");
}
}