public void stopIt() {
    super.interrupt();
  }
@Test
  public void stopIt_interrupts_worker() {
    doAnswer(invocationOnMock -> {
      await().atMost(10, TimeUnit.SECONDS).until(() -> false);
      return null;
    }).when(monitored).hardStop();

    // max stop timeout is 100 milliseconds
    AbstractStopperThread stopper = new AbstractStopperThread("theThreadName", () -> monitored.hardStop(), 5000L){};
    stopper.start();

    verify(monitored, timeout(3_000)).hardStop();

    stopper.stopIt();

    int timeout = 10;
    try {
      await()
        .atMost(timeout, TimeUnit.SECONDS)
        .until(() -> !stopper.isAlive());
    } catch (ConditionTimeoutException conditionTimeoutException) {
      fail(String.format("Thread was still alive after %d seconds.", timeout));
    }

  }