use of org.springframework.integration.file.filters.RegexPatternFileListFilter in project spring-integration by spring-projects.
the class PatternMatchingFileListFilterTests method matchSingleFile.
@Test
public void matchSingleFile() {
File[] files = new File[] { new File("/some/path/test.txt") };
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
List<File> accepted = filter.filterFiles(files);
assertEquals(1, accepted.size());
}
use of org.springframework.integration.file.filters.RegexPatternFileListFilter in project spring-integration by spring-projects.
the class PatternMatchingFileListFilterTests method matchSubset.
@Test
public void matchSubset() {
File[] files = new File[] { new File("/some/path/foo.txt"), new File("/some/path/foo.not"), new File("/some/path/bar.txt"), new File("/some/path/bar.not") };
Pattern pattern = Pattern.compile("[a-z]+\\.txt");
RegexPatternFileListFilter filter = new RegexPatternFileListFilter(pattern);
List<File> accepted = filter.filterFiles(files);
assertEquals(2, accepted.size());
assertTrue(accepted.contains(new File("/some/path/foo.txt")));
assertTrue(accepted.contains(new File("/some/path/bar.txt")));
}
Aggregations