### Question:
Files { public static void ensureMv(final String src, final String dest) throws IOException { ensureMv(src, dest, false); }  static void ensureDir(final String dir); static void ensureDir(final String dir, final boolean checkWrite); static void ensureDir(final File dir); static void ensureDir(final File dir, final boolean checkWrite); static String checkDir(final String dir); static String checkDir(final String dir, final boolean checkWrite); static String checkDir(final File dir); static String checkDir(final File dir, final boolean checkWrite); static String checkFile(final File file, final boolean checkWrite); static void ensureMv(final String src, final String dest); static void ensureMv(final String src, final String dest, final boolean overwrite); static void ensureMv(final File src, final File dest); static void ensureMv(final File src, final File dest, final boolean overwrite); static String mv(final String src, final String dest); static String mv(final String src, final String dest, final boolean overwrite); static String mv(final File src, final File dest); static String mv(final File src, final File dest, final boolean overwrite); static File tmpDir();  }### Answer:
@Test(expected = IOException.class) public void testEnsureMvIOException() throws Exception { File src = mock(File.class); File dest = mock(File.class); File parent = mock(File.class); expect(src.exists()).andReturn(true).anyTimes(); expect(src.isDirectory()).andReturn(false).anyTimes(); expect(src.canRead()).andReturn(true); expect(src.renameTo(dest)).andReturn(true); replay(src); expect(parent.exists()).andReturn(true); expect(parent.isDirectory()).andReturn(true); expect(parent.canRead()).andReturn(true); expect(parent.canExecute()).andReturn(true); expect(parent.canWrite()).andReturn(true); replay(parent); expect(dest.exists()).andReturn(true).anyTimes(); expect(dest.isDirectory()).andReturn(false); expect(dest.getParentFile()).andReturn(parent); expect(dest.getPath()).andReturn("").anyTimes(); replay(dest); Files.ensureMv(src, dest); }