Skip to content

Commit 9fa4aac

Browse files
committed
Add logging of excluded files
1 parent 3a87bb5 commit 9fa4aac

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,12 @@ public TestSplit(
179179
final @NotNull BasicFileAttributes attributes) {
180180
if (path != null) {
181181
final var candidate = path.normalize();
182-
if (includeMatcher.matches(candidate) && !excludeMatcher.matches(candidate)) {
183-
files.add(candidate);
182+
if (includeMatcher.matches(candidate)) {
183+
if (excludeMatcher.matches(candidate)) {
184+
LOG.debug("Excluding test file {}", candidate);
185+
} else {
186+
files.add(candidate);
187+
}
184188
}
185189
}
186190
return FileVisitResult.CONTINUE;
@@ -205,10 +209,10 @@ public TestSplit(
205209
final var declaration = compilationUnit.findFirst(ClassOrInterfaceDeclaration.class).orElseThrow();
206210
final var className = declaration.getFullyQualifiedName().orElseThrow();
207211
if (declaration.isInterface()) {
208-
LOG.info("Skipping test interface {}", className);
212+
LOG.info("Skipping interface {}", className);
209213
continue;
210214
} else if (declaration.isAbstract()) {
211-
LOG.info("Skipping abstract test class {}", className);
215+
LOG.info("Skipping abstract class {}", className);
212216
continue;
213217
}
214218
final var hasSkipTestImport = compilationUnit.getImports()

src/test/java/de/donnerbart/split/TestSplitTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void setUp() throws Exception {
3838
.resolve("example");
3939
Files.createDirectories(projectFolder);
4040
// ignored tests
41+
copyResourceToTarget(projectFolder, "tests/AbstractTest.java", "AbstractTest.java", PERMISSIONS);
4142
copyResourceToTarget(projectFolder, "tests/BaseTest.java", "BaseTest.java", PERMISSIONS);
4243
copyResourceToTarget(projectFolder, "tests/DisabledTest.java", "DisabledTest.java", PERMISSIONS);
4344
copyResourceToTarget(projectFolder, "tests/IgnoreTest.java", "IgnoreTest.java", PERMISSIONS);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package de.donnerbart.example;
2+
3+
abstract class AbstractTest {
4+
5+
abstract void implementableMethod();
6+
}

0 commit comments

Comments
 (0)