ControllerUtils { static boolean hasDeclaredRequestMethodAnnotation(Method method) { return Arrays.stream(method.getDeclaredAnnotations()).anyMatch(anno -> anno.annotationType().getAnnotation(HttpMethod.class) != null); } private  ControllerUtils(); static boolean isController(Class<?> clazz); static boolean isControllerMethod(Method method);  }
@Test public void shouldIdentifyDeclaredRequestMethodAnnotations() throws NoSuchMethodException { assertThat(ControllerUtils.hasDeclaredRequestMethodAnnotation( MethodController.class.getMethod("foo")), is(false)); assertThat(ControllerUtils.hasDeclaredRequestMethodAnnotation( MethodController.class.getMethod("bar")), is(true)); }