@Override
  public void checkDone() throws IllegalStateException {
    if (range.getFrom() == range.getTo()) {
      return;
    }
    checkState(
        lastAttemptedOffset != null,
        "Last attempted offset should not be null. No work was claimed in non-empty range %s.",
        range);
    checkState(
        lastAttemptedOffset >= range.getTo() - 1,
        "Last attempted offset was %s in range %s, claiming work in [%s, %s) was not attempted",
        lastAttemptedOffset,
        range,
        lastAttemptedOffset + 1,
        range.getTo());
  }
@Test
  public void testDoneBeforeClaim() throws Exception {
    expected.expectMessage(
        "Last attempted offset should not be null. No work was claimed in non-empty range [100, 200)");
    OffsetRangeTracker tracker = new OffsetRangeTracker(new OffsetRange(100, 200));
    tracker.checkDone();
  }