#192 - Added test case to show that mapping lookup works.

The test case added shows that the mapping lookup also works if the method invoked is referred to via a mapped sub type.
This commit is contained in:
Oliver Gierke
2014-06-05 12:34:23 +02:00
parent 4f7e1cb561
commit daeae2e98a

View File

@@ -355,6 +355,16 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
assertThat(link.getHref(), endsWith("/something/with%20blank/foo"));
}
/**
* @see #192
*/
@Test
public void usesRootMappingOfTargetClassForMethodsOfParentClass() {
Link link = linkTo(methodOn(ChildControllerWithRootMapping.class).someEmptyMappedMethod()).withSelfRel();
assertThat(link.getHref(), endsWith("/root"));
}
private static UriComponents toComponents(Link link) {
return UriComponentsBuilder.fromUriString(link.getHref()).build();
}
@@ -445,4 +455,15 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
@RequestMapping("/child")
interface ChildWithTypeMapping extends ParentWithMethod {}
interface ParentControllerWithoutRootMapping {
@RequestMapping
Object someEmptyMappedMethod();
}
@RequestMapping("/root")
interface ChildControllerWithRootMapping extends ParentControllerWithoutRootMapping {
}
}