DirWalker extends DirectoryWalker implements Runnable { protected DirWalker(List<File> filesAndDirs, FileExclusionManager fileExclusionManager) { super(); this.filesAndDirs = filesAndDirs; this.changedList = ChangedList.getInstance(); this.fileExclusionManager = fileExclusionManager; } protected  DirWalker(List<File> filesAndDirs, FileExclusionManager fileExclusionManager); void run(); void stopWalk(); static DirWalker start(List<File> topDirs, FileExclusionManager fileExclusionManager); boolean walkComplete(); int getFilesCount();  }
@Test public void testDirWalker() { fileExclusionManager = createMock(FileExclusionManager.class); expect(fileExclusionManager.isExcluded(isA(File.class))).andReturn(false).times(2, Integer.MAX_VALUE); File checkDir = new File("src"); List<File> dirs = new ArrayList<File>(); dirs.add(checkDir); replayAll(); DirWalker dirWalker = createDirWalker(dirs); int walkerFilesFound = 0; while (changedList.reserve() != null) { walkerFilesFound++; } Collection<File> tempDirFiles = listFiles(checkDir); assertEquals(walkerFilesFound, tempDirFiles.size()); assertEquals(walkerFilesFound, dirWalker.getFilesCount()); }