### Question:
MappingsResolver { public static List<String> getRequestMappings(Method method, Class<?> controller) { return getJoinedMappings(method, controller, PathExtractor.of(RequestMapping.class, RequestMapping::path)); }  static List<String> getRequestMappings(Method method, Class<?> controller); static List<String> getMessageMappings(Method method, Class<?> controller); static List<String> getSubscribeMappings(Method method, Class<?> controller);  }### Answer:
@Test public void getRequestMappings_noClassAnnotation() throws NoSuchMethodException { Class<?> ctrl = StandardController.class; Method none = ctrl.getDeclaredMethod("none"); Method slash = ctrl.getDeclaredMethod("slash"); Method slashPath = ctrl.getDeclaredMethod("slashPath"); Method longPath = ctrl.getDeclaredMethod("slashLongPath"); Method pathAttribute = ctrl.getDeclaredMethod("pathAttribute"); assertEquals(singletonList("/"), MappingsResolver.getRequestMappings(none, ctrl)); assertEquals(singletonList("/"), MappingsResolver.getRequestMappings(slash, ctrl)); assertEquals(singletonList("/path"), MappingsResolver.getRequestMappings(slashPath, ctrl)); assertEquals(singletonList("/long/path"), MappingsResolver.getRequestMappings(longPath, ctrl)); assertEquals(singletonList("/path/attr"), MappingsResolver.getRequestMappings(pathAttribute, ctrl)); }
@Test public void getRequestMappings_emptyClassAnnotation() throws NoSuchMethodException { Class<?> ctrl = EmptyAnnotatedController.class; Method none = ctrl.getDeclaredMethod("none"); Method test = ctrl.getDeclaredMethod("test"); assertEquals(singletonList("/"), MappingsResolver.getRequestMappings(none, ctrl)); assertEquals(singletonList("/test"), MappingsResolver.getRequestMappings(test, ctrl)); }
@Test public void getRequestMappings_classAnnotationWithPrefix() throws NoSuchMethodException { Class<?> ctrl = PrefixAnnotatedController.class; Method none = ctrl.getDeclaredMethod("none"); Method test = ctrl.getDeclaredMethod("test"); assertEquals(singletonList("/prefix"), MappingsResolver.getRequestMappings(none, ctrl)); assertEquals(singletonList("/prefix/test"), MappingsResolver.getRequestMappings(test, ctrl)); }
@Test public void getRequestMappings_childController_prefixOverride() throws NoSuchMethodException { Class<?> ctrl = PrefixOverrideChildController.class; Method none = ctrl.getMethod("none"); Method test = ctrl.getMethod("test"); assertEquals(singletonList("/child"), MappingsResolver.getRequestMappings(none, ctrl)); assertEquals(singletonList("/child/test"), MappingsResolver.getRequestMappings(test, ctrl)); }
@Test public void getRequestMappings_multiplePaths() throws NoSuchMethodException { Class<?> ctrl = MultiPathController.class; Method test = ctrl.getMethod("test"); List<String> expectedPaths = Arrays.asList("/path1/path3", "/path1/path4", "/path2/path3", "/path2/path4"); assertEquals(expectedPaths, MappingsResolver.getRequestMappings(test, ctrl)); }