private void generateReferenceAccountsAndContainers() {
    // a set that records the account ids that have already been taken.
    Set<Short> accountIdSet = new HashSet<>();
    // generate a single reference account and container that can be referenced by refAccount and refContainer respectively.
    refAccountId = Utils.getRandomShort(random);
    accountIdSet.add(refAccountId);
    refAccountName = UUID.randomUUID().toString();
    refAccountStatus = random.nextBoolean() ? AccountStatus.ACTIVE : AccountStatus.INACTIVE;
    refContainerId = Utils.getRandomShort(random);
    refContainerName = UUID.randomUUID().toString();
    refContainerStatus = random.nextBoolean() ? ContainerStatus.ACTIVE : ContainerStatus.INACTIVE;
    refContainerDescription = UUID.randomUUID().toString();
    refContainerCaching = random.nextBoolean();
    refParentAccountId = refAccountId;
    refContainerEncryption = random.nextBoolean();
    refContainerPreviousEncryption = refContainerEncryption || random.nextBoolean();
    refContainerMediaScanDisabled = random.nextBoolean();
    refReplicationPolicy = TestUtils.getRandomString(10);
    refContainerTtlRequired = random.nextBoolean();
    refContainer = new ContainerBuilder(refContainerId, refContainerName, refContainerStatus, refContainerDescription,
        refParentAccountId).setEncrypted(refContainerEncryption)
        .setPreviouslyEncrypted(refContainerPreviousEncryption)
        .setCacheable(refContainerCaching)
        .setMediaScanDisabled(refContainerMediaScanDisabled)
        .setReplicationPolicy(refReplicationPolicy)
        .setTtlRequired(refContainerTtlRequired)
        .build();
    refAccount =
        new AccountBuilder(refAccountId, refAccountName, refAccountStatus).addOrUpdateContainer(refContainer).build();
    generateRefAccounts(idToRefAccountMap, idToRefContainerMap, accountIdSet, NUM_REF_ACCOUNT,
        NUM_CONTAINER_PER_ACCOUNT);
  }
Randomly generates a single {@link Account} and {@link Container}. It also generates a collection of reference
{@link Account}s and {@link Container}s that can be referred from {@link #idToRefAccountMap} and
{@link #idToRefContainerMap}.
ambry-account/src/test/java/com/github/ambry/account/HelixAccountServiceTest.java