@Test
  public void serDeTest() throws IOException {
    UUID sessionId = UUID.randomUUID();
    UUID incarnationId = UUID.randomUUID();
    LogSegmentName logSegmentName = LogSegmentName.generateFirstSegmentName(isLogSegmented);
    Offset offset = new Offset(logSegmentName, 0);
    MockId key = new MockId(TestUtils.getRandomString(10));
    MockId resetKey = new MockId(TestUtils.getRandomString(10));
    PersistentIndex.IndexEntryType resetKeyType =
        PersistentIndex.IndexEntryType.values()[(new Random()).nextInt(PersistentIndex.IndexEntryType.values().length)];
    short resetKeyVersion = (short) random.nextInt(5);
    if (!isLogSegmented) {
      // UnInitialized
      doSerDeTest(new StoreFindToken(), VERSION_0, VERSION_1, VERSION_2, VERSION_3);

      // Journal based token
      doSerDeTest(
          new StoreFindToken(offset, sessionId, incarnationId, false, null, null, UNINITIALIZED_RESET_KEY_VERSION),
          VERSION_0, VERSION_1, VERSION_2, VERSION_3);
      // Journal based token with resetKey and resetKeyType specified (VERSION_3)
      doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, false, resetKey, resetKeyType, resetKeyVersion),
          VERSION_3);

      // inclusiveness is present only in {VERSION_2, VERSION_3}
      doSerDeTest(
          new StoreFindToken(offset, sessionId, incarnationId, true, null, null, UNINITIALIZED_RESET_KEY_VERSION),
          VERSION_2, VERSION_3);
      doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, true, resetKey, resetKeyType, resetKeyVersion),
          VERSION_3);

      // Index based
      doSerDeTest(
          new StoreFindToken(key, offset, sessionId, incarnationId, null, null, UNINITIALIZED_RESET_KEY_VERSION),
          VERSION_0, VERSION_1, VERSION_2, VERSION_3);
      doSerDeTest(new StoreFindToken(key, offset, sessionId, incarnationId, resetKey, resetKeyType, resetKeyVersion),
          VERSION_3);
    } else {
      // UnInitialized
      doSerDeTest(new StoreFindToken(), VERSION_1, VERSION_2, VERSION_3);

      // Journal based token
      doSerDeTest(
          new StoreFindToken(offset, sessionId, incarnationId, false, null, null, UNINITIALIZED_RESET_KEY_VERSION),
          VERSION_1, VERSION_2, VERSION_3);
      doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, false, resetKey, resetKeyType, resetKeyVersion),
          VERSION_3);

      // inclusiveness is present only in VERSION_2
      doSerDeTest(
          new StoreFindToken(offset, sessionId, incarnationId, true, null, null, UNINITIALIZED_RESET_KEY_VERSION),
          VERSION_2, VERSION_3);
      doSerDeTest(new StoreFindToken(offset, sessionId, incarnationId, true, resetKey, resetKeyType, resetKeyVersion),
          VERSION_3);

      // Index based
      doSerDeTest(
          new StoreFindToken(key, offset, sessionId, incarnationId, null, null, UNINITIALIZED_RESET_KEY_VERSION),
          VERSION_1, VERSION_2, VERSION_3);
      doSerDeTest(new StoreFindToken(key, offset, sessionId, incarnationId, resetKey, resetKeyType, resetKeyVersion),
          VERSION_3);
    }
  }
Tests {@link StoreFindToken} serialization/deserialization.
@throws IOException
ambry-store/src/test/java/com/github/ambry/store/StoreFindTokenTest.java