GH-1463: added test case for string concatenation with request mappings from parent classes with attribute names

This commit is contained in:
Martin Lippert
2025-02-11 09:04:16 +01:00
parent 27f4456b44
commit da0a8b8b24
3 changed files with 27 additions and 0 deletions

View File

@@ -257,6 +257,14 @@ public class RequestMappingSymbolProviderTest {
assertTrue(containsSymbol(symbols, "@/superpath/subclass", docUri, 6, 1, 6, 34));
}
@Test
void testMappingPathFromSuperclassWithStringConcatenationPerAttribute() throws Exception {
String docUri = directory.toPath().resolve("src/main/java/org/test/inheritance/SubclassWithMappingFromParentWithStringConcatenationPerAttribute.java").toUri().toString();
List<? extends WorkspaceSymbol> symbols = indexer.getSymbols(docUri);
assertEquals(1, symbols.size());
assertTrue(containsSymbol(symbols, "@/superpath/subclass", docUri, 6, 1, 6, 42));
}
@Test
void testMappingPathFromSuperclassWithMethodsAndPathAttribute() throws Exception {
String docUri = directory.toPath().resolve("src/main/java/org/test/inheritance/SubclassWithMappingFromParentWithMethods.java").toUri().toString();

View File

@@ -0,0 +1,12 @@
package org.test.inheritance;
import org.springframework.web.bind.annotation.RequestMapping;
public class SubclassWithMappingFromParentWithStringConcatenationPerAttribute extends SuperclassWithMappingPathWithStringConcatenationPerAttribute {
@RequestMapping(value = "/sub" + "class")
public String hello() {
return "Hello";
}
}

View File

@@ -0,0 +1,7 @@
package org.test.inheritance;
import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping(path = "/super" + "path")
public class SuperclassWithMappingPathWithStringConcatenationPerAttribute {
}