@Test
public void copyFailsDirectoryMkdirs() throws IOException {

    File tempFile = folder.newFile();
    Map<String, File> files = new HashMap<String, File>();
    files.put("newName", tempFile);
    File outFile = mock(File.class);
    when(outFile.isDirectory()).thenReturn(Boolean.TRUE);
    when(outFile.exists()).thenReturn(Boolean.FALSE);
    when(outFile.mkdirs()).thenReturn(Boolean.FALSE);
    try {
        OutputWriterHelper.moveToDirectory(files, outFile, ExistingOutputPolicy.OVERWRITE, context);
        fail("Exception expected");
    } catch (IOException e) {
        assertTrue("Different exception expected.", e.getMessage().startsWith("Unable to make destination"));
    }
}