GH-1463: additional test cases for concatenated bean names in component annotations
This commit is contained in:
@@ -153,6 +153,14 @@ public class SpringIndexerBeansTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testScanComponentClassWithNameAndStringConcatenation() throws Exception {
|
||||
String docUri = directory.toPath().resolve("src/main/java/org/test/SpecialNameComponentWithStringConcatenation.java").toUri().toString();
|
||||
SpringIndexerHarness.assertDocumentSymbols(indexer, docUri,
|
||||
SpringIndexerHarness.symbol("@Component(\"special\" + \"Name\")", "@+ 'specialName' (@Component) SpecialNameComponentWithStringConcatenation")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testScanComponentClassWithNameAndAttributeName() throws Exception {
|
||||
String docUri = directory.toPath().resolve("src/main/java/org/test/SpecialNameComponentWithAttributeName.java").toUri().toString();
|
||||
@@ -161,6 +169,22 @@ public class SpringIndexerBeansTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testScanComponentClassWithNameAndAttributeNameWithStringConcatenation() throws Exception {
|
||||
String docUri = directory.toPath().resolve("src/main/java/org/test/SpecialNameComponentWithAttributeNameWithStringConcatenation.java").toUri().toString();
|
||||
SpringIndexerHarness.assertDocumentSymbols(indexer, docUri,
|
||||
SpringIndexerHarness.symbol("@Component(value = \"specialName\" + \"WithAttributeName\")", "@+ 'specialNameWithAttributeName' (@Component) SpecialNameComponentWithAttributeNameWithStringConcatenation")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testScanComponentClassWithNameWithStringConcatenationAndConstant() throws Exception {
|
||||
String docUri = directory.toPath().resolve("src/main/java/org/test/SpecialNameComponentWithStringConcatenationAndConstant.java").toUri().toString();
|
||||
SpringIndexerHarness.assertDocumentSymbols(indexer, docUri,
|
||||
SpringIndexerHarness.symbol("@Component(\"special\" + \"Name\" + Constants.SAMPLE_CONSTANT)", "@+ 'specialNameSampleConstant' (@Component) SpecialNameComponentWithStringConcatenationAndConstant")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testScanSimpleControllerClass() throws Exception {
|
||||
String docUri = directory.toPath().resolve("src/main/java/org/test/SimpleController.java").toUri().toString();
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.test;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String SAMPLE_CONSTANT = "SampleConstant";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.test;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component(value = "specialName" + "WithAttributeName")
|
||||
public class SpecialNameComponentWithAttributeNameWithStringConcatenation {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.test;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("special" + "Name")
|
||||
public class SpecialNameComponentWithStringConcatenation {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.test;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("special" + "Name" + Constants.SAMPLE_CONSTANT)
|
||||
public class SpecialNameComponentWithStringConcatenationAndConstant {
|
||||
}
|
||||
Reference in New Issue
Block a user