### Question:
CanWriteFileFilter implements FileFilter, Serializable { @Override public boolean accept(final FileSelectInfo fileInfo) throws FileSystemException { try (final FileObject file = fileInfo.getFile()) { final FileSystem fileSystem = file.getFileSystem(); if (file.exists()) { if (!fileSystem.hasCapability(Capability.WRITE_CONTENT)) { return false; } return file.isWriteable(); } if (!fileSystem.hasCapability(Capability.CREATE)) { return false; } return file.getParent().isWriteable(); } } protected  CanWriteFileFilter(); @Override boolean accept(final FileSelectInfo fileInfo); static final FileFilter CAN_WRITE; static final FileFilter CANNOT_WRITE; }### Answer:
@Test public void testAcceptCanWrite() throws FileSystemException { Assert.assertTrue(CanWriteFileFilter.CAN_WRITE.accept(writeableFileInfo)); Assert.assertFalse(CanWriteFileFilter.CAN_WRITE.accept(readOnlyFileInfo)); Assert.assertTrue(CanWriteFileFilter.CAN_WRITE.accept(notExistingFileInfo)); }
@Test public void testAcceptCannotWrite() throws FileSystemException { Assert.assertFalse(CanWriteFileFilter.CANNOT_WRITE.accept(writeableFileInfo)); Assert.assertTrue(CanWriteFileFilter.CANNOT_WRITE.accept(readOnlyFileInfo)); Assert.assertFalse(CanWriteFileFilter.CANNOT_WRITE.accept(notExistingFileInfo)); }