### Question:
PatternFileSelector implements FileSelector { @Override public String toString() { return this.pattern.toString(); } PatternFileSelector(final Pattern pattern);  PatternFileSelector(final String regex);  PatternFileSelector(final String regex, final int flags); @Override boolean includeFile(final FileSelectInfo fileInfo); @Override String toString(); @Override boolean traverseDescendents(final FileSelectInfo fileInfo);  }### Answer:
@Test public void testFileExtensions() throws Exception { final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES); Assert.assertTrue(foArray.length > 0); final String regExPrefix = ".*\\."; final Set<String> extensionSet = new HashSet<>(); for (final FileObject fo : foArray) { extensionSet.add(regExPrefix + fo.getName().getExtension()); } final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(), Arrays.asList(foArray).toString()); assertEquals(message, ExtensionCount, extensionSet.size()); for (final String extension : extensionSet) { final FileSelector selector = new PatternFileSelector(extension); final FileObject[] list = BaseFolder.findFiles(selector); assertEquals(FilesPerExtensionCount, list.length); } for (final FileObject fo : foArray) { final FileSelector selector = new PatternFileSelector(regExPrefix + fo.getName().getExtension()); final FileObject[] list = BaseFolder.findFiles(selector); assertEquals(FilesPerExtensionCount, list.length); } }