ServiceFileFilter implements FileFilter, Serializable { @Override public boolean accept(File file) { if (!file.isFile()) { return false; } return !file.getName().toLowerCase().endsWith(".log"); } private  ServiceFileFilter(); @Override boolean accept(File file); static final FileFilter INSTANCE; }
@Test public void testLogFile() throws Exception { File file = File.createTempFile("test", ".log"); try { FileFilter filter = ServiceFileFilter.INSTANCE; Assert.assertFalse(filter.accept(file)); } finally { file.delete(); } }
@Test public void testDirectory() throws Exception { File file = File.createTempFile("test", ".log"); try { FileFilter filter = ServiceFileFilter.INSTANCE; Assert.assertFalse(filter.accept(file.getParentFile())); } finally { file.delete(); } }
@Test public void testServiceFile() throws Exception { File file = File.createTempFile("test", ".tmp"); try { FileFilter filter = ServiceFileFilter.INSTANCE; Assert.assertTrue(filter.accept(file)); } finally { file.delete(); } }