private static boolean chooseFeatureMethod(Method m) {
return m.getName().startsWith(FEATURE_METHOD_PREFIX) && !m.getName().equals(FEATURE_METHOD_PREFIX);
}
private static void assertFeatureConvention(final Method m) {
final FeatureDescriptor annotation = m.getAnnotation(FeatureDescriptor.class);
final Class featuresClass = m.getDeclaringClass();
// all "features" need an annotation
assertNotNull(annotation);
// needs to match pattern of "support" followed by "name" value in annotation
assertEquals(m.getName(), FEATURE_METHOD_PREFIX + annotation.name());
try {
final Field f = featuresClass.getField(FEATURE_FIELD_PREFIX + convertToUnderscore(annotation.name()).toUpperCase());
assertEquals(annotation.name(), f.get(null));
} catch (Exception e) {
fail(String.format(ERROR_FIELD, annotation.name()));
}
}