@Test public void givenAFileWithMatchingFileNameButNotExtension_whenAccept_thenReturnFalse() { initializeFileFilterWithTestValues(); setupFileMockAsADirectory(false); when(fileMock.getName()) .thenReturn(CERTIFICATE_WITH_MATCHING_NAME_BUT_NOT_EXTENSION); boolean isAccepted = testFileFilter.accept(fileMock); assertFalse(isAccepted); }
@Override public final boolean accept(@NonNull File file) { checkNotNull(file, "The input file descriptor was null"); if (file.isDirectory()) return false; else if (file.isFile()) { if (file.getName().equals(name + extension)) return true; } return false; }
FileFilterByNameMatch implements FileFilter { @Override public final boolean accept(@NonNull File file) { checkNotNull(file, "The input file descriptor was null"); if (file.isDirectory()) return false; else if (file.isFile()) { if (file.getName().equals(name + extension)) return true; } return false; } }
FileFilterByNameMatch implements FileFilter { @Override public final boolean accept(@NonNull File file) { checkNotNull(file, "The input file descriptor was null"); if (file.isDirectory()) return false; else if (file.isFile()) { if (file.getName().equals(name + extension)) return true; } return false; } FileFilterByNameMatch(@NonNull String name, @NonNull String extension); }
FileFilterByNameMatch implements FileFilter { @Override public final boolean accept(@NonNull File file) { checkNotNull(file, "The input file descriptor was null"); if (file.isDirectory()) return false; else if (file.isFile()) { if (file.getName().equals(name + extension)) return true; } return false; } FileFilterByNameMatch(@NonNull String name, @NonNull String extension); @Override final boolean accept(@NonNull File file); }
FileFilterByNameMatch implements FileFilter { @Override public final boolean accept(@NonNull File file) { checkNotNull(file, "The input file descriptor was null"); if (file.isDirectory()) return false; else if (file.isFile()) { if (file.getName().equals(name + extension)) return true; } return false; } FileFilterByNameMatch(@NonNull String name, @NonNull String extension); @Override final boolean accept(@NonNull File file);  }