@Override
  public boolean tryAcquireJobLock(Configuration conf) {
    Path path = new Path(locksDir, String.format(LOCKS_DIR_JOB_FILENAME, getJobJtIdentifier(conf)));

    return tryCreateFile(conf, path);
  }
@Test
  public void testCatchingRemoteException() throws IOException {
    FileSystem mockedFileSystem = Mockito.mock(FileSystem.class);
    RemoteException thrownException =
        new RemoteException(AlreadyBeingCreatedException.class.getName(), "Failed to CREATE_FILE");
    Mockito.when(mockedFileSystem.createNewFile(Mockito.any())).thenThrow(thrownException);

    HDFSSynchronization synchronization =
        new HDFSSynchronization("someDir", (conf) -> mockedFileSystem);

    assertFalse(synchronization.tryAcquireJobLock(configuration));
  }