function bean symbols now generated if function interface is found in inheritance hierarchy
This commit is contained in:
@@ -69,6 +69,39 @@ public class SpringIndexerFunctionBeansTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanSpecializedFunctionClass() throws Exception {
|
||||
SpringIndexerHarness indexer = new SpringIndexerHarness(harness.getServer(), projectFinder, symbolProviders);
|
||||
File directory = new File(ProjectsHarness.class.getResource("/test-projects/test-annotation-indexing-beans/").toURI());
|
||||
indexer.initialize(indexer.wsFolder(directory));
|
||||
|
||||
String uriPrefix = "file://" + directory.getAbsolutePath();
|
||||
indexer.assertDocumentSymbols(uriPrefix + "/src/main/java/org/test/FunctionFromSpecializedClass.java",
|
||||
symbol("FunctionFromSpecializedClass", "@> 'functionFromSpecializedClass' (@Bean) Function<String,String>")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanSpecializedFunctionInterface() throws Exception {
|
||||
SpringIndexerHarness indexer = new SpringIndexerHarness(harness.getServer(), projectFinder, symbolProviders);
|
||||
File directory = new File(ProjectsHarness.class.getResource("/test-projects/test-annotation-indexing-beans/").toURI());
|
||||
indexer.initialize(indexer.wsFolder(directory));
|
||||
|
||||
String uriPrefix = "file://" + directory.getAbsolutePath();
|
||||
indexer.assertDocumentSymbols(uriPrefix + "/src/main/java/org/test/FunctionFromSpecializedInterface.java",
|
||||
symbol("FunctionFromSpecializedInterface", "@> 'functionFromSpecializedInterface' (@Bean) Function<String,String>")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanInconsistentInterfaceHierarchy() throws Exception {
|
||||
SpringIndexerHarness indexer = new SpringIndexerHarness(harness.getServer(), projectFinder, symbolProviders);
|
||||
File directory = new File(ProjectsHarness.class.getResource("/test-projects/test-annotation-indexing-beans/").toURI());
|
||||
indexer.initialize(indexer.wsFolder(directory));
|
||||
|
||||
String uriPrefix = "file://" + directory.getAbsolutePath();
|
||||
indexer.assertDocumentSymbols(uriPrefix + "/src/main/java/org/test/LoopedFunctionClass.java");
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// harness code
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.test;
|
||||
|
||||
public class FunctionFromSpecializedClass extends SpecializedFunctionClass {
|
||||
|
||||
@Override
|
||||
public String apply(String t) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.test;
|
||||
|
||||
public class FunctionFromSpecializedInterface implements SpecializedFunctionInterface {
|
||||
|
||||
@Override
|
||||
public String apply(String t) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.test;
|
||||
|
||||
public class LoopedFunctionClass implements LoopedInterface1 {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.test;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface LoopedInterface1 extends LoopedInterface2 {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.test;
|
||||
|
||||
public interface LoopedInterface2 extends LoopedInterface1 {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.test;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class SpecializedFunctionClass implements Function<String, String> {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.test;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface SpecializedFunctionInterface extends Function<String, String> {
|
||||
}
|
||||
Reference in New Issue
Block a user