feat: Removed predicate constructor for WildcardFileFinder, added test to WildcardFileFinderTest
@@ -16,20 +16,7 @@ import java.util.function.Predicate;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.jetbrains.annotations.NotNull;
-import com.synopsys.integration.common.util.finder.FileFinder;
-
public class WildcardFileFinder implements FileFinder {
- private final Predicate<File> filter;
-
- public WildcardFileFinder(final Predicate<File> filter) {
- this.filter = filter;
- }
-
- public WildcardFileFinder() {
- // if no predicate is passed, just accept all files
- this.filter = file -> true;
- }
-
@NotNull
@Override
public List<File> findFiles(final File directoryToSearch, final Predicate<File> filter, final int depth, final boolean findInsideMatchingDirectories) {
@@ -45,7 +32,7 @@ public class WildcardFileFinder implements FileFinder {
return foundFiles;
}
for (final File file : allFiles) {
- final boolean matches = filter.test(file) && this.filter.test(file);
+ final boolean matches = filter.test(file);
if (matches) {
foundFiles.add(file);
}
@@ -59,14 +46,6 @@ public class WildcardFileFinder implements FileFinder {
return foundFiles;
}
- public List<File> findFiles(final File directoryToSearch, final int depth, final boolean findInsideMatchingDirectories) {
- return findFiles(directoryToSearch, filter, depth, findInsideMatchingDirectories);
- }
-
- public List<File> findFiles(final File directoryToSearch) {
- return findFiles(directoryToSearch, filter);
- }
-
@NotNull
@Override
public List<File> findFiles(final File directoryToSearch, final List<String> filenamePatterns, final int depth, final boolean findInsideMatchingDirectories) {
