boolean (final Class testClass, final String testName, final HighlightingFlag flag) { Method method; try { method = testClass.getMethod("test" + testName); } catch (Exception e) { throw new RuntimeException(e); } final HighlightingFlags annotation = method.getAnnotation(HighlightingFlags.class); if (annotation != null) { final HighlightingFlag[] testOptions = annotation.value(); if (testOptions != null) { Arrays.sort(testOptions); return Arrays.binarySearch(testOptions, flag) >= 0; } } return false; }