FileEventHandler fileEventHandler = mock(FileEventHandler.class);
walker.setFileEventHandler(fileEventHandler);
DirectoryEventHandler dirEventhandler = mock(DirectoryEventHandler.class);
when(dirEventhandler.onEvent(canonicalFile(TEST_ROOT, "dir1"),
null, 0, false)).thenReturn(new ResourceId(1L, ""));
when(dirEventhandler.onEvent(canonicalFile(TEST_ROOT, "dir2"),
null, 0, false)).thenReturn(new ResourceId(2L, ""));
when(dirEventhandler.onEvent(canonicalFile(TEST_ROOT, "dir1/subdir1"),
new ResourceId(1L, ""), 1, false)).thenReturn(new ResourceId(11L, ""));
when(dirEventhandler.onEvent(canonicalFile(TEST_ROOT, "dir1/subdir2"),
new ResourceId(1L, ""), 1, false)).thenReturn(new ResourceId(12L, ""));
when(dirEventhandler.onEvent(canonicalFile(TEST_ROOT, "dir2/subdir1"),
new ResourceId(2L, ""), 1, false)).thenReturn(new ResourceId(21L, ""));
when(dirEventhandler.onEvent(canonicalFile(TEST_ROOT, "dir2/subdir2"),
new ResourceId(2L, ""), 1, false)).thenReturn(new ResourceId(22L, ""));
walker.setDirectoryEventHandler(dirEventhandler);
walker.walk(profileSpec, new ProfileWalkState());
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/file11.ext"), new ResourceId(1L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/file12.ext"), new ResourceId(1L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/file13.ext"), new ResourceId(1L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/file14.ext"), new ResourceId(1L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/file15.ext"), new ResourceId(1L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir1/file111.ext"),
new ResourceId(11L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir1/file112.ext"),
new ResourceId(11L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir1/file113.ext"),
new ResourceId(11L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir1/file114.ext"),
new ResourceId(11L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir1/file115.ext"),
new ResourceId(11L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir2/file121.ext"),
new ResourceId(12L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir2/file122.ext"),
new ResourceId(12L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir2/file123.ext"),
new ResourceId(12L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir2/file124.ext"),
new ResourceId(12L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir1/subdir2/file125.ext"),
new ResourceId(12L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/file21.ext"), new ResourceId(2L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/file21.ext"), new ResourceId(2L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/file21.ext"), new ResourceId(2L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/file21.ext"), new ResourceId(2L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/file21.ext"), new ResourceId(2L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir1/file211.ext"),
new ResourceId(21L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir1/file212.ext"),
new ResourceId(21L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir1/file213.ext"),
new ResourceId(21L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir1/file214.ext"),
new ResourceId(21L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir1/file215.ext"),
new ResourceId(21L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir2/file221.ext"),
new ResourceId(22L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir2/file222.ext"),
new ResourceId(22L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir2/file223.ext"),
new ResourceId(22L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir2/file224.ext"),
new ResourceId(22L, ""), null);
verify(fileEventHandler).onEvent(canonicalFile(TEST_ROOT, "dir2/subdir2/file225.ext"),
new ResourceId(22L, ""), null);
verify(fileEventHandler, times(30)).onEvent(any(File.class), (ResourceId) any(),
(ResourceId) isNull());
}