Skip to content

Commit

Permalink
Support meta-annotations in AbstractArchUnitTestDescriptor
Browse files Browse the repository at this point in the history
Resolves TNG#282
  • Loading branch information
daniel-shuy authored and codecholeric committed Feb 4, 2020
1 parent 16f3561 commit 36c4192
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.Set;

import org.junit.platform.commons.support.AnnotationSupport;
import org.junit.platform.engine.TestDescriptor;
import org.junit.platform.engine.TestSource;
import org.junit.platform.engine.TestTag;
Expand All @@ -39,15 +40,15 @@ abstract class AbstractArchUnitTestDescriptor extends AbstractTestDescriptor imp
super(uniqueId, displayName, source);
tags = Arrays.stream(elements).map(this::findTagsOn).flatMap(Collection::stream).collect(toSet());
skipResult = Arrays.stream(elements)
.filter(e -> e.isAnnotationPresent(ArchIgnore.class))
.map(e -> e.getAnnotation(ArchIgnore.class))
.flatMap(e -> AnnotationSupport.findAnnotation(e, ArchIgnore.class).stream())
.findFirst()
.map(ignore -> SkipResult.skip(ignore.reason()))
.orElse(SkipResult.doNotSkip());
}

private Set<TestTag> findTagsOn(AnnotatedElement annotatedElement) {
return Arrays.stream(annotatedElement.getAnnotationsByType(ArchTag.class))
return AnnotationSupport.findRepeatableAnnotations(annotatedElement, ArchTag.class)
.stream()
.map(annotation -> TestTag.create(annotation.value()))
.collect(toSet());
}
Expand Down

0 comments on commit 36c4192

Please sign in to comment.