@Test
  public void rebuildTokenWhenLastSegmentAutoClosedTestCase3() throws StoreException {
    assumeTrue(isLogSegmented);
    autoCloseLastLogSegmentAndCleanUpJournal();
    IndexSegment lastIndexSegment = stateForTokenTest.index.getIndexSegments().lastEntry().getValue();
    Offset validOffset =
        new Offset(lastIndexSegment.getLogSegmentName(), lastIndexSegment.getStartOffset().getOffset());
    StoreFindToken startToken =
        new StoreFindToken(lastIndexSegment.listIterator(lastIndexSegment.size()).previous().getKey(), validOffset,
            stateForTokenTest.sessionId, stateForTokenTest.incarnationId, lastIndexSegment.getResetKey(),
            lastIndexSegment.getResetKeyType(), lastIndexSegment.getResetKeyLifeVersion());
    FindInfo findInfo = stateForTokenTest.index.findEntriesSince(startToken, 1);
    StoreFindToken token = (StoreFindToken) findInfo.getFindToken();
    StoreFindToken expectedToken = startToken;
    compareTokens(expectedToken, token);
  }
Test closing last log segment and generating an index based token pointing to last entry of last index segment,
it should return the same index token.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java