@Override
  public synchronized Page<String> listAllValidDatasetVersions(String accountName, String containerName,
      String datasetName, String pageToken) {
    Account account = nameToAccountMap.get(accountName);
    short accountId = account.getId();
    short containerId = account.getContainerByName(containerName).getId();
    List<DatasetVersionRecord> datasetRecords =
        new ArrayList<>(idToDatasetVersionMap.get(new Pair<>(accountId, containerId)).values());
    List<String> versionList = datasetRecords.stream()
        .filter(record -> datasetName.equals(record.getDatasetName()))
        .map(DatasetVersionRecord::getVersion)
        .collect(Collectors.toList());
    Collections.sort(versionList);
    int index = 0;
    if (pageToken == null && PAGE_SIZE < 1) {
      return new Page<>(versionList, null);
    }
    if (pageToken != null) {
      index = Collections.binarySearch(versionList, pageToken);
    }
    return new Page<>(versionList.subList(index, index + PAGE_SIZE), versionList.get(index + PAGE_SIZE));
  }
Constructor.
@param shouldReturnOnlyUnknown {@code true} if always returns {@link InMemAccountService#UNKNOWN_ACCOUNT} when queried
                                                    by account name; {@code false} to do the actual query.
@param notifyConsumers {@code true} if consumers should be notified of account changes. {@code false} otherwise.
ambry-test-utils/src/main/java/com/github/ambry/account/InMemAccountService.java