@Test
  public void equalityTest() {
    short version = 0;
    Random random = new Random();
    long lastBlobUpdateTime = random.nextLong();
    long bytesRead = random.nextLong();
    Set<String> lastReadBlobIds = new HashSet<>();
    lastReadBlobIds.add("blobid1");
    lastReadBlobIds.add("blobid2");

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

    //compare token constructed from all constructors
    CosmosUpdateTimeFindToken token1 = new CosmosUpdateTimeFindToken(lastBlobUpdateTime, bytesRead, lastReadBlobIds);
    CosmosUpdateTimeFindToken token2 = new CosmosUpdateTimeFindToken(lastBlobUpdateTime, bytesRead, lastReadBlobIds);
    ensureEqual(token1, token2);

    token1 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime, bytesRead, lastReadBlobIds);
    token2 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime, bytesRead, lastReadBlobIds);
    ensureEqual(token1, token2);

    //ensure inequality for any unequal field
    token2 = new CosmosUpdateTimeFindToken((short) 1, lastBlobUpdateTime, bytesRead, lastReadBlobIds);
    ensureUnequal(token1, token2);

    token2 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime + 100, bytesRead, lastReadBlobIds);
    ensureUnequal(token1, token2);

    token2 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime, bytesRead, new HashSet<>());
    ensureUnequal(token1, token2);

    Set<String> unEqualBlobidSet = new HashSet<>();
    unEqualBlobidSet.add("blobid1");
    token2 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime, bytesRead, unEqualBlobidSet);
    ensureUnequal(token1, token2);

    unEqualBlobidSet.add("blobid3");
    token2 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime, bytesRead, unEqualBlobidSet);
    ensureUnequal(token1, token2);

    token2 = new CosmosUpdateTimeFindToken(version, lastBlobUpdateTime, bytesRead + 10, lastReadBlobIds);
    ensureUnequal(token1, token2);

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