public static ConstructorOrMethod findDeclaredFactoryMethod(Class<?> cls,
IAnnotationFinder finder) {
ConstructorOrMethod result = null;
for (Method method : cls.getMethods()) {
IFactoryAnnotation f = (IFactoryAnnotation) finder.findAnnotation(method,
IFactoryAnnotation.class);
if (null != f) {
if (result != null) {
throw new TestNGException(cls.getName() + ": only one @Factory method allowed");
}
result = new ConstructorOrMethod(method);
result.setEnabled(f.getEnabled());
break;
}
}
if (result == null) {