### Question:
SimpleMover implements Callable<InputFile> { @Override public InputFile call() throws IOException { final Path dst = this.entry.getTrackedDir(this.target); checkParent(dst); if (entry.getCurrentDir() == dst || (!fs.exists(dst) && fs.rename(entry.getCurrentDir(), dst))) { entry.updateCurrentDir(this.target); } else { log.error("Unable to move file " + entry.getCurrentDir().toUri() + " to " + dst.toUri() + ", skipping"); } return entry; } SimpleMover(Cache<Path,Path> directoryCache, InputFile entry, TrackedDir destination, FileSystem fs); @Override InputFile call();  }### Answer:
@Test public void testCall() throws Exception { FileSystem fs = FileSystem.getLocal(new Configuration()); Path file = getTestFile(fs); InputFile inFile = new InputFile("foo", file, 0, 0, 0, fmc.getBaseHDFSDir()); SimpleMover instance = new SimpleMover(directoryCache, inFile, TrackedDir.FLAGGED_DIR, fs); InputFile result = instance.call(); assertTrue("Should have moved to flagged", result.isMoved()); assertTrue(result.getCurrentDir().equals(result.getFlagged())); }
@Test public void testFailCall() throws Exception { FileSystem fs = FileSystem.getLocal(new Configuration()); Path file = getTestFile(fs); InputFile entry = new InputFile("foo", file, 0, 0, 0, fmc.getBaseHDFSDir()); fs.mkdirs(entry.getFlagging().getParent()); fs.copyFromLocalFile(file, entry.getFlagging()); SimpleMover instance = new SimpleMover(directoryCache, entry, TrackedDir.FLAGGING_DIR, fs); InputFile result = instance.call(); assertFalse("should not have moved due to collision", result.isMoved()); assertTrue(result.getCurrentDir().equals(result.getPath())); }