@Override
  public IsBounded isBounded() {
    // If current range has been done, the range should be bounded.
    if (lastAttemptedOffset != null && lastAttemptedOffset == Long.MAX_VALUE) {
      return IsBounded.BOUNDED;
    }
    return range.getTo() == Long.MAX_VALUE ? IsBounded.UNBOUNDED : IsBounded.BOUNDED;
  }
@Test
  public void testIsBounded() throws Exception {
    SimpleEstimator simpleEstimator = new SimpleEstimator();
    GrowableOffsetRangeTracker tracker = new GrowableOffsetRangeTracker(0L, simpleEstimator);
    assertEquals(IsBounded.UNBOUNDED, tracker.isBounded());
    assertTrue(tracker.tryClaim(0L));
    assertEquals(IsBounded.UNBOUNDED, tracker.isBounded());

    // After split, the restriction should be bounded.
    simpleEstimator.setEstimateRangeEnd(16L);
    tracker.trySplit(0.5);
    assertEquals(IsBounded.BOUNDED, tracker.isBounded());

    // The restriction should be bounded after all the work has been claimed.
    tracker = new GrowableOffsetRangeTracker(0L, simpleEstimator);
    tracker.tryClaim(Long.MAX_VALUE);
    assertEquals(IsBounded.BOUNDED, tracker.isBounded());
  }