PT #159444911: Addition - id matching, type verification

This commit is contained in:
BoykoAlex
2018-08-20 17:15:25 -04:00
parent 01d6829c17
commit 42a308d9c8
2 changed files with 96 additions and 16 deletions

View File

@@ -732,7 +732,7 @@ public class AutowiredHoverProviderTest {
.add(LiveBean.builder()
.id("someComponent")
.type("com.example.SomeComponent")
.dependencies("dependencyA", "dependencyB")
.dependencies("dependencyA")
.build()
)
.add(LiveBean.builder()
@@ -784,7 +784,7 @@ public class AutowiredHoverProviderTest {
.add(LiveBean.builder()
.id("someComponent")
.type("com.example.SomeComponent")
.dependencies("dependencyA", "dependencyB")
.dependencies("dependencyA")
.build()
)
.add(LiveBean.builder()
@@ -824,6 +824,53 @@ public class AutowiredHoverProviderTest {
editor.assertNoHover("@Autowired");
}
@Test
public void qualifierWrongTypeWiredBean() throws Exception {
LiveBeansModel beans = LiveBeansModel.builder()
.add(LiveBean.builder()
.id("someComponent")
.type("com.example.SomeComponent")
.dependencies("dependency")
.build()
)
.add(LiveBean.builder()
.id("dependency")
.type("com.example.DependencyA")
.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.beans.factory.annotation.Qualifier;\n" +
"import org.springframework.stereotype.Component;\n" +
"\n" +
"@Component\n" +
"public class SomeComponent {\n" +
"\n" +
" @Autowired\n" +
" @Qualifier(\"dependency\")\n" +
" private DependencyB a;\n" +
"\n" +
" public SomeComponent() {\n" +
" }\n" +
"\n" +
"}\n"
);
editor.assertHighlights("@Component");
editor.assertNoHover("@Autowired");
}
@Test
public void anonymousInnerClassBeanWiring() throws Exception {
LiveBeansModel beans = LiveBeansModel.builder()