RestartDirWalker extends DirWalker { protected RestartDirWalker(List<File> topDirs, long lastBackup, FileExclusionManager fileExclusionManager) { super(topDirs, fileExclusionManager); this.lastBackup = lastBackup; changedDirs = new ArrayList<File>(); } protected  RestartDirWalker(List<File> topDirs,
                               long lastBackup,
                               FileExclusionManager fileExclusionManager); static DirWalker start(List<File> topDirs,
                                  long lastBackup,
                                  FileExclusionManager fileExclusionManager);  }
@Test public void testRestartDirWalker() throws Exception { List<File> dirs = new ArrayList<File>(); dirs.add(tempDir); File subDir1 = new File(tempDir, "subdir1"); subDir1.mkdir(); File sub1file1 = File.createTempFile("subdir1", "file1", subDir1); File sub1file2 = File.createTempFile("subdir1", "file2", subDir1); File subDir2 = new File(tempDir, "subdir2"); subDir2.mkdir(); File sub2file1 = File.createTempFile("subdir2", "file1", subDir2); File subDir3 = new File(tempDir, "subdir3"); subDir3.mkdir(); File sub3file1 = File.createTempFile("subdir3", "file1", subDir3); long restartTime = System.currentTimeMillis(); Thread.sleep(1000); File sub2file2 = File.createTempFile("subdir2", "file2", subDir2); FileUtils.touch(sub1file1); RestartDirWalker rDirWalker = new RestartDirWalker(dirs, restartTime, new FileExclusionManager()); assertFalse(rDirWalker.walkComplete()); rDirWalker.walkDirs(); assertTrue(rDirWalker.walkComplete()); List<File> changedFiles = new ArrayList<File>(); ChangedFile changedFile = changedList.reserve(); while (changedFile != null) { changedFiles.add(changedFile.getFile()); changedFile = changedList.reserve(); } assertEquals(3, changedFiles.size()); for (File file : changedFiles) { assertTrue(file.equals(sub1file1) || file.equals(sub2file1) || file.equals(sub2file2)); } assertNull(changedList.reserve()); }