public static Optional<String> finishUpdateCheck(Future<Optional<String>> updateMessageFuture) {
    if (updateMessageFuture.isDone()) {
      try {
        return updateMessageFuture.get();
      } catch (InterruptedException | ExecutionException ex) {
        // No need to restore the interrupted status. The intention here is to silently consume any
        // kind of error
      }
    }
    updateMessageFuture.cancel(true);
    return Optional.empty();
  }
@Test
  public void testFinishUpdateCheck_notDone() {
    @SuppressWarnings("unchecked")
    Future<Optional<String>> updateCheckFuture = Mockito.mock(Future.class);
    Mockito.when(updateCheckFuture.isDone()).thenReturn(false);

    Optional<String> result = UpdateChecker.finishUpdateCheck(updateCheckFuture);
    assertThat(result).isEmpty();
  }