use of com.carrotsearch.randomizedtesting.annotations.TestGroup in project randomizedtesting by randomizedtesting.
the class GroupEvaluator method collectGroups.
private HashMap<Class<? extends Annotation>, TestGroupInfo> collectGroups(List<TestCandidate> testCandidates) {
final HashMap<Class<? extends Annotation>, TestGroupInfo> groups = new HashMap<Class<? extends Annotation>, TestGroupInfo>();
// Collect all groups declared on methods and instance classes.
HashSet<Class<?>> clazzes = new HashSet<Class<?>>();
HashSet<Annotation> annotations = new HashSet<Annotation>();
for (TestCandidate c : testCandidates) {
final Class<?> testClass = c.getTestClass();
if (!clazzes.contains(testClass)) {
clazzes.add(testClass);
annotations.addAll(Arrays.asList(testClass.getAnnotations()));
}
annotations.addAll(Arrays.asList(c.method.getAnnotations()));
}
// Get TestGroup annotated annotations.
for (Annotation ann : annotations) {
Class<? extends Annotation> annType = ann.annotationType();
if (!groups.containsKey(ann) && annType.isAnnotationPresent(TestGroup.class)) {
groups.put(annType, new TestGroupInfo(annType));
}
}
return groups;
}
Aggregations