Skip to content

Commit 7823bef

Browse files
committed
Rework isIgnoredClassOrPackage method
DEVSIX-3147
1 parent d5a5913 commit 7823bef

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

pdftest/src/main/java/com/itextpdf/test/WrappedSamplesRunner.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,36 @@ private static RunnerParams checkIfTestAndCreateParams(String className, RunnerS
251251

252252
private static boolean isIgnoredClassOrPackage(String fullName, RunnerSearchConfig searchConfig) {
253253
for (String ignoredPath : searchConfig.getIgnoredPaths()) {
254-
if (fullName.contains(ignoredPath)) {
255-
return true;
254+
File currentFile = getFileByLocation("target/classes", ignoredPath);
255+
256+
if (currentFile == null) {
257+
currentFile = getFileByLocation("target/test-classes", ignoredPath);
258+
}
259+
260+
if (currentFile != null) {
261+
if ((currentFile.isDirectory() && fullName.contains(ignoredPath))
262+
|| (currentFile.isFile() && fullName.equals(ignoredPath))) {
263+
return true;
264+
}
256265
}
257266
}
258267
return false;
259268
}
260269

270+
private static File getFileByLocation(String targetSubDirectory, String filePath) {
271+
File currentFile = Paths.get(targetSubDirectory, filePath.replace(".", "/")).toFile();
272+
if (currentFile.exists()) {
273+
return currentFile;
274+
}
275+
276+
currentFile = Paths.get(targetSubDirectory, (filePath.replace(".", "/")) + ".class").toFile();
277+
if (currentFile.exists()) {
278+
return currentFile;
279+
}
280+
281+
return null;
282+
}
283+
261284
private static class RunnerParams {
262285
String className;
263286
String ignoreMessage;

0 commit comments

Comments
 (0)