@Test
  public void equalityTest() {
    short version = 0;
    Random random = new Random();
    long bytesRead = random.nextLong();
    String startContinuationToken = "start";
    String endContinuationToken = "end";
    int totalItems = random.nextInt();
    int index = random.nextInt() % totalItems;
    String azureRequestId = UUID.randomUUID().toString();

    //compare empty tokens
    ensureEqual(new CosmosChangeFeedFindToken(), new CosmosChangeFeedFindToken());

    //compare token constructed from all constructors
    CosmosChangeFeedFindToken token1 =
        new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems,
            azureRequestId);
    CosmosChangeFeedFindToken token2 =
        new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems,
            azureRequestId);
    ensureEqual(token1, token2);

    token1 = new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems,
        azureRequestId, version);
    token2 = new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems,
        azureRequestId, version);
    ensureEqual(token1, token2);

    //ensure inequality for any unequal field
    token2 =
        new CosmosChangeFeedFindToken(bytesRead + 1, startContinuationToken, endContinuationToken, index, totalItems,
            azureRequestId, version);
    ensureUnequal(token1, token2);

    token2 =
        new CosmosChangeFeedFindToken(bytesRead, startContinuationToken + "1", endContinuationToken, index, totalItems,
            azureRequestId);
    ensureUnequal(token1, token2);

    token2 =
        new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken + "1", index, totalItems,
            azureRequestId);
    ensureUnequal(token1, token2);

    token2 =
        new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index + 1, totalItems,
            azureRequestId);
    ensureUnequal(token1, token2);

    token2 =
        new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems + 1,
            azureRequestId);
    ensureUnequal(token1, token2);

    token2 = new CosmosChangeFeedFindToken(bytesRead, startContinuationToken, endContinuationToken, index, totalItems,
        UUID.randomUUID().toString());
    ensureUnequal(token1, token2);

    token2 = new CosmosChangeFeedFindToken();
    ensureUnequal(token1, token2);
  }
Test for correctness of {@code CosmosChangeFeedFindToken#equals(Object)}
ambry-cloud/src/test/java/com/github/ambry/cloud/azure/CosmosChangeFeedFindTokenTest.java