@Test
  public void rebuildTokenWhenInputJournalBasedTokenTestCase1() throws StoreException {
    assumeTrue(isLogSegmented);
    IndexSegment lastIndexSegment = stateForTokenTest.index.getIndexSegments().lastEntry().getValue();
    Offset validOffset =
        new Offset(lastIndexSegment.getLogSegmentName(), lastIndexSegment.getStartOffset().getOffset());
    Offset nextOffset = stateForTokenTest.index.journal.getEntriesSince(validOffset, false).get(0).getOffset();
    StoreFindToken startToken =
        new StoreFindToken(validOffset, stateForTokenTest.sessionId, stateForTokenTest.incarnationId, false,
            lastIndexSegment.getResetKey(), lastIndexSegment.getResetKeyType(),
            lastIndexSegment.getResetKeyLifeVersion());
    FindInfo findInfo = stateForTokenTest.index.findEntriesSince(startToken, 1);
    StoreFindToken token = (StoreFindToken) findInfo.getFindToken();
    StoreFindToken expectedToken =
        new StoreFindToken(nextOffset, stateForTokenTest.sessionId, stateForTokenTest.incarnationId, false,
            lastIndexSegment.getResetKey(), lastIndexSegment.getResetKeyType(),
            lastIndexSegment.getResetKeyLifeVersion());
    compareTokens(expectedToken, token);
  }
Tests generating a journal based token mapping to first indexEntry in last index segment. it will return the next
journal based token in journal.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java