FileStatus fstat1 = mock(FileStatus.class);
when(fstat1.getPath()).thenReturn(new Path("test1"));
when(fstat1.toString()).thenReturn("test1");
fs.setFileStatus("test1", fstat1);
fs.setGlobStatus("test1", new FileStatus[]{fstat1});
PathData item1 = new PathData("test1", fs.getConf());
FileStatus fstat2 = mock(FileStatus.class);
when(fstat2.getPath()).thenReturn(new Path("test2"));
when(fstat2.toString()).thenReturn("test2");
fs.setFileStatus("test2", fstat2);
fs.setGlobStatus("test2", new FileStatus[]{fstat2});
PathData item2 = new PathData("test2", fs.getConf());
FileStatus fstat3 = mock(FileStatus.class);
when(fstat3.getPath()).thenReturn(new Path("test3"));
when(fstat3.toString()).thenReturn("test3");
fs.setFileStatus("test3", fstat3);
fs.setGlobStatus("test3", new FileStatus[]{fstat3});
PathData item3 = new PathData("test3", fs.getConf());
assertEquals(Result.PASS, exec.apply(item1));
verifyNoMoreInteractions(out);
verifyNoMoreInteractions(err);
assertEquals(Result.PASS, exec.apply(item2));
verify(out).println("TestCommand.processPath:"+item1.toString());
verify(out).println("TestCommand.processPath:"+item2.toString());
verifyNoMoreInteractions(out);
verifyNoMoreInteractions(err);
assertEquals(Result.PASS, exec.apply(item3));
verifyNoMoreInteractions(out);
verifyNoMoreInteractions(err);
exec.finish();
verify(out).println("TestCommand.processPath:"+item3.toString());
verifyNoMoreInteractions(out);
verifyNoMoreInteractions(err);
}