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

  when(remoteDirectoryManager.isDir(anyString())).thenReturn(true);
  when(remoteDirectoryManager.isRemote(anyString())).thenReturn(true);
  when(remoteDirectoryManager.existsRemoteFile(anyString()))
      .thenReturn(true);
  String remoteUri = "hdfs://remotedir1/remotedir2";
  when(fsOperations.uploadToRemoteFile(any(Path.class), anyString()))
      .thenReturn(new Path(remoteUri));
  when(fsOperations.downloadAndZip(anyString(), anyString()))
      .thenReturn("remotedir2.zip");
  Localization localization = new Localization();
  localization.setLocalPath("remotedir2");
  localization.setRemoteUri(remoteUri);
  Localizer localizer = createLocalizerWithLocalizations(localization);
  localizer.handleLocalizations(service);
  verify(fsOperations).validFileSize(anyString());
}