public void scheduleHeartbeat() {
    startedHeartbeat = executorService.schedule(heartbeatTask, DEFAULT_HEARTBEAT_PERIOD, TimeUnit.SECONDS);
  }
@Test
  public void close_exceptionOnComplete_doesNotThrowException() {
    when(executorService.schedule(any(HeartbeatTask.class), anyLong(), any(TimeUnit.class))).thenReturn(task);
    doThrow(new IllegalStateException()).when(asyncContext).complete();
    underTest.scheduleHeartbeat();

    Assertions.assertThatCode(underTest::close)
      .doesNotThrowAnyException();
  }