@@ -22,9 +22,10 @@ public List<FileEntity> getJavaTestFiles(String directoryPath, boolean recursive
2222 .forEach (filePath -> {
2323 if (filePath .getFileName ().toString ().lastIndexOf ("." )!=-1 ) {
2424 String fileNameWithoutExtension = filePath .getFileName ().toString ().substring (0 , filePath .getFileName ().toString ().lastIndexOf ("." ));
25- //test files should have 'test' as either a prefix or suffix
25+ //test files should have 'test(s) ' as either a prefix or suffix
2626 if (filePath .toString ().toLowerCase ().endsWith (".java" ) &&
27- (fileNameWithoutExtension .toLowerCase ().startsWith ("test" ) || fileNameWithoutExtension .toLowerCase ().endsWith ("test" ))) {
27+ (fileNameWithoutExtension .toLowerCase ().startsWith ("test" ) || fileNameWithoutExtension .toLowerCase ().endsWith ("test" ) ||
28+ fileNameWithoutExtension .toLowerCase ().endsWith ("tests" ) || fileNameWithoutExtension .toLowerCase ().endsWith ("tests" ))) {
2829 files .add (new FileEntity (filePath ));
2930 }
3031 }
@@ -72,9 +73,10 @@ public FileVisitResult visitFile(Path file,
7273 throws IOException {
7374 if (file .getFileName ().toString ().lastIndexOf ("." ) !=-1 ) {
7475 String fileNameWithoutExtension = file .getFileName ().toString ().substring (0 , file .getFileName ().toString ().lastIndexOf ("." ));
75- //test files should have 'test' as either a prefix or suffix
76+ //test files should have 'test(s) ' as either a prefix or suffix
7677 if (file .toString ().toLowerCase ().endsWith (".java" ) &&
77- (fileNameWithoutExtension .toLowerCase ().startsWith ("test" ) || fileNameWithoutExtension .toLowerCase ().endsWith ("test" ))) {
78+ (fileNameWithoutExtension .toLowerCase ().startsWith ("test" ) || fileNameWithoutExtension .toLowerCase ().endsWith ("test" ) ||
79+ fileNameWithoutExtension .toLowerCase ().endsWith ("tests" ) || fileNameWithoutExtension .toLowerCase ().endsWith ("tests" ))) {
7880 files .add (new FileEntity (file ));
7981 }
8082 }
0 commit comments