### Question:
StateRestorer { boolean hasCompleted(final long recordOffset, final long endOffset) { return endOffset == 0 || recordOffset >= readTo(endOffset); } StateRestorer(final TopicPartition partition,
                  final StateRestoreCallback stateRestoreCallback,
                  final Long checkpoint,
                  final long offsetLimit,
                  final boolean persistent); TopicPartition partition();  }### Answer:
@Test public void shouldBeCompletedIfRecordOffsetGreaterThanEndOffset() throws Exception { assertTrue(restorer.hasCompleted(11, 10)); }
@Test public void shouldBeCompletedIfRecordOffsetGreaterThanOffsetLimit() throws Exception { assertTrue(restorer.hasCompleted(51, 100)); }
@Test public void shouldBeCompletedIfEndOffsetAndRecordOffsetAreZero() throws Exception { assertTrue(restorer.hasCompleted(0, 0)); }
@Test public void shouldBeCompletedIfOffsetAndOffsetLimitAreZero() throws Exception { final StateRestorer restorer = new StateRestorer(new TopicPartition("topic", 1), callback, null, 0, true); assertTrue(restorer.hasCompleted(0, 10)); }