Skip to content

Commit dfd7067

Browse files
committed
Add JUnit 4 @ignore to skip test annotations
1 parent 98fc5a2 commit dfd7067

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/de/donnerbart/split/TestSplit.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
44
import com.github.javaparser.JavaParser;
55
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
6+
import com.github.javaparser.ast.expr.AnnotationExpr;
67
import org.jetbrains.annotations.NotNull;
78
import org.jetbrains.annotations.Nullable;
89
import org.slf4j.Logger;
@@ -27,6 +28,9 @@
2728

2829
public class TestSplit {
2930

31+
private static final @NotNull Set<String> SKIP_TEST_ANNOTATIONS =
32+
Set.of("org.junit.jupiter.api.Disabled", "Disabled", "org.junit.Ignore", "Ignore");
33+
3034
private static final @NotNull Logger LOG = LoggerFactory.getLogger(TestSplit.class);
3135

3236
private final int splitIndex;
@@ -189,7 +193,8 @@ public void run() throws Exception {
189193
final var className = declaration.getFullyQualifiedName().orElseThrow();
190194
if (declaration.getAnnotations()
191195
.stream()
192-
.anyMatch(annotationExpr -> "Disabled".equals(annotationExpr.getNameAsString()))) {
196+
.map(AnnotationExpr::getNameAsString)
197+
.anyMatch(SKIP_TEST_ANNOTATIONS::contains)) {
193198
LOG.info("Skipping disabled test {}", className);
194199
} else {
195200
classNames.add(className);

0 commit comments

Comments
 (0)