### Question:
DirPoll extends SimpleLogSource implements Runnable, FilenameFilter, Configurable, Destroyable { public boolean accept(File dir, String name) { boolean result; String ext = currentPriority >= 0 ? (String) prio.elementAt(currentPriority) : null; if (ext != null) { if (isRegexPriorityMatching()) { if (!name.matches(ext)) return false; } else { if (!name.endsWith(ext)) return false; } } File f = new File (dir, name); if (acceptZeroLength){ result = f.isFile(); } else { result = f.isFile() && f.length() > 0; } return result; } DirPoll(); synchronized void setPath(String base); void setShouldTimestampArchive(boolean shouldTimestampArchive); void setArchiveDateFormat(String dateFormat); void setShouldArchive(boolean shouldArchive); void setShouldCompressArchive(boolean shouldCompressArchive); void setAcceptZeroLength(boolean acceptZeroLength); String getPath(); void setRequestDir(String dir); void setResponseDir(String dir); void setTmpDir(String dir); void setBadDir(String dir); void setRunDir(String dir); void setArchiveDir(String dir); void setPollInterval(long pollInterval); void setResponseSuffix(String suffix); long getPollInterval(); void setProcessor(Object processor); boolean isRegexPriorityMatching(); void setRegexPriorityMatching(boolean regexPriorityMatching); Object getProcessor(); void setConfiguration(Configuration cfg); void setPriorities(String priorities); synchronized void setThreadPool(ThreadPool pool); boolean accept(File dir, String name); void run(); void destroy(); void createDirs(); void addPriority(String fileExtension); void pause(); void unpause(); boolean isPaused();  }### Answer:
@Test public void testAccept() throws Throwable { DirPoll dirPoll = new DirPoll(); dirPoll.addPriority("testDirPollFileExtension"); boolean result = dirPoll.accept(new File("testDirPollParam1"), "testDirPollName"); assertFalse(result, "result"); }
@Test public void testAcceptThrowsArrayIndexOutOfBoundsException() throws Throwable { try { new DirPoll().accept(new File("testDirPollParam1"), "testDirPollName"); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("0 >= 0", ex.getMessage(), "ex.getMessage()"); } }