@Test(expected = IOException.class)
public void ensureDirectoriesExistWhenMkdirThrows() throws IOException {

    FileSystem fsMock = mock(FileSystem.class);
    when(fsMock.mkdirs(any(Path.class))).thenThrow(new IOException("Ayo"));
    FileSystemUtils.ensureDirectoriesExist(Collections.singleton(new Path("randomPath")), fsMock);
}