### Question:
FileListIterator implements Iterator<File> { @Override public boolean hasNext() { if (next == curr) step(); return next != null; } FileListIterator(File dir, boolean recursive); @Override boolean hasNext(); @Override File next(); @Override void remove();  }### Answer:
@Test public void testHasNext_emptyDir_nonRecursive() throws Exception { final FileListIterator it = new FileListIterator(new MockFile("A", true), false); assertFalse(it.hasNext()); assertFalse(it.hasNext()); }
@Test public void testHasNext_emptyDir_recursive() throws Exception { final FileListIterator it = new FileListIterator(new MockFile("A", true), true); assertFalse(it.hasNext()); assertFalse(it.hasNext()); }