@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(); ensureEqual(new CosmosChangeFeedFindToken(), new CosmosChangeFeedFindToken()); 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); 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); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("version: ").append(getVersion()); sb.append(" bytesRead: ").append(getBytesRead()); sb.append(" type: ").append(getType().toString()); sb.append(" startContinuationToken: ").append(startContinuationToken); sb.append(" endContinuationToken: ").append(endContinuationToken); sb.append(" index: ").append(index); sb.append(" totalItems: ").append(totalItems); sb.append(" cacheSessionId: ").append(cacheSessionId); return sb.toString(); }
CosmosChangeFeedFindToken implements FindToken { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("version: ").append(getVersion()); sb.append(" bytesRead: ").append(getBytesRead()); sb.append(" type: ").append(getType().toString()); sb.append(" startContinuationToken: ").append(startContinuationToken); sb.append(" endContinuationToken: ").append(endContinuationToken); sb.append(" index: ").append(index); sb.append(" totalItems: ").append(totalItems); sb.append(" cacheSessionId: ").append(cacheSessionId); return sb.toString(); } }
CosmosChangeFeedFindToken implements FindToken { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("version: ").append(getVersion()); sb.append(" bytesRead: ").append(getBytesRead()); sb.append(" type: ").append(getType().toString()); sb.append(" startContinuationToken: ").append(startContinuationToken); sb.append(" endContinuationToken: ").append(endContinuationToken); sb.append(" index: ").append(index); sb.append(" totalItems: ").append(totalItems); sb.append(" cacheSessionId: ").append(cacheSessionId); return sb.toString(); } CosmosChangeFeedFindToken();  CosmosChangeFeedFindToken(long bytesRead, String startContinuationToken, String endContinuationToken,
      int index, int totalItems, String cacheSessionId);  CosmosChangeFeedFindToken(long bytesRead, String startContinuationToken, String endContinuationToken,
      int index, int totalItems, String cacheSessionId, short version); }
CosmosChangeFeedFindToken implements FindToken { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("version: ").append(getVersion()); sb.append(" bytesRead: ").append(getBytesRead()); sb.append(" type: ").append(getType().toString()); sb.append(" startContinuationToken: ").append(startContinuationToken); sb.append(" endContinuationToken: ").append(endContinuationToken); sb.append(" index: ").append(index); sb.append(" totalItems: ").append(totalItems); sb.append(" cacheSessionId: ").append(cacheSessionId); return sb.toString(); } CosmosChangeFeedFindToken();  CosmosChangeFeedFindToken(long bytesRead, String startContinuationToken, String endContinuationToken,
      int index, int totalItems, String cacheSessionId);  CosmosChangeFeedFindToken(long bytesRead, String startContinuationToken, String endContinuationToken,
      int index, int totalItems, String cacheSessionId, short version); static CosmosChangeFeedFindToken fromBytes(DataInputStream inputStream); @Override byte[] toBytes(); int size(); @Override boolean equals(Object o); String getStartContinuationToken(); String getEndContinuationToken(); int getIndex(); int getTotalItems(); @Override long getBytesRead(); @Override short getVersion(); @Override FindTokenType getType(); String getCacheSessionId(); @Override int hashCode(); @Override String toString(); }
CosmosChangeFeedFindToken implements FindToken { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("version: ").append(getVersion()); sb.append(" bytesRead: ").append(getBytesRead()); sb.append(" type: ").append(getType().toString()); sb.append(" startContinuationToken: ").append(startContinuationToken); sb.append(" endContinuationToken: ").append(endContinuationToken); sb.append(" index: ").append(index); sb.append(" totalItems: ").append(totalItems); sb.append(" cacheSessionId: ").append(cacheSessionId); return sb.toString(); } CosmosChangeFeedFindToken();  CosmosChangeFeedFindToken(long bytesRead, String startContinuationToken, String endContinuationToken,
      int index, int totalItems, String cacheSessionId);  CosmosChangeFeedFindToken(long bytesRead, String startContinuationToken, String endContinuationToken,
      int index, int totalItems, String cacheSessionId, short version); static CosmosChangeFeedFindToken fromBytes(DataInputStream inputStream); @Override byte[] toBytes(); int size(); @Override boolean equals(Object o); String getStartContinuationToken(); String getEndContinuationToken(); int getIndex(); int getTotalItems(); @Override long getBytesRead(); @Override short getVersion(); @Override FindTokenType getType(); String getCacheSessionId(); @Override int hashCode(); @Override String toString();  }