ControllerUtils { public static boolean isController(Class<?> clazz) { return AnnotationUtils.getAnnotation(clazz, Controller.class) != null || Arrays.stream(clazz.getMethods()).anyMatch(m -> AnnotationUtils.getAnnotation(m, Controller.class) != null); } private  ControllerUtils(); static boolean isController(Class<?> clazz); static boolean isControllerMethod(Method method);  }
@Test public void shouldIdentifyControllerClasses() { assertThat(ControllerUtils.isController(ClassController.class), is(true)); assertThat(ControllerUtils.isController(MethodController.class), is(true)); assertThat(ControllerUtils.isController(NoController.class), is(false)); }