Source:
private void initializeRefContainers() throws JSONException { refContainerIds = new ArrayList<>(); refContainerNames = new ArrayList<>(); refContainerStatuses = new ArrayList<>(); refContainerDescriptions = new ArrayList<>(); refContainerEncryptionValues = new ArrayList<>(); refContainerPreviousEncryptionValues = new ArrayList<>(); refContainerCachingValues = new ArrayList<>(); refContainerMediaScanDisabledValues = new ArrayList<>(); refContainerReplicationPolicyValues = new ArrayList<>(); containerJsonList = new ArrayList<>(); refContainers = new ArrayList<>(); Set<Short> containerIdSet = new HashSet<>(); Set<String> containerNameSet = new HashSet<>(); for (int i = 0; i < CONTAINER_COUNT; i++) { short containerId = Utils.getRandomShort(random); String containerName = UUID.randomUUID().toString(); if (!containerIdSet.add(containerId) || !containerNameSet.add(containerName)) { i--; continue; } refContainerIds.add(containerId); refContainerNames.add(containerName); refContainerStatuses.add(random.nextBoolean() ? ContainerStatus.ACTIVE : ContainerStatus.INACTIVE); refContainerDescriptions.add(UUID.randomUUID().toString()); boolean encrypted = (i % 2 == 0); boolean previouslyEncrypted = encrypted || (i % 4 < 2); refContainerEncryptionValues.add(encrypted); refContainerPreviousEncryptionValues.add(previouslyEncrypted); refContainerCachingValues.add(random.nextBoolean()); refContainerMediaScanDisabledValues.add(random.nextBoolean()); refContainerReplicationPolicyValues.add(UtilsTest.getRandomString(10)); refContainers.add(new Container(refContainerIds.get(i), refContainerNames.get(i), refContainerStatuses.get(i), refContainerDescriptions.get(i), refContainerEncryptionValues.get(i), refContainerPreviousEncryptionValues.get(i), refContainerCachingValues.get(i), refContainerMediaScanDisabledValues.get(i), refContainerReplicationPolicyValues.get(i), refAccountId)); containerJsonList.add(buildContainerJson(refContainers.get(i))); } }

Target:
private void initializeRefContainers() throws JSONException { refContainerIds = new ArrayList<>(); refContainerNames = new ArrayList<>(); refContainerStatuses = new ArrayList<>(); refContainerDescriptions = new ArrayList<>(); refContainerEncryptionValues = new ArrayList<>(); refContainerPreviousEncryptionValues = new ArrayList<>(); refContainerCachingValues = new ArrayList<>(); refContainerMediaScanDisabledValues = new ArrayList<>(); refContainerReplicationPolicyValues = new ArrayList<>(); containerJsonList = new ArrayList<>(); refContainers = new ArrayList<>(); Set<Short> containerIdSet = new HashSet<>(); Set<String> containerNameSet = new HashSet<>(); for (int i = 0; i < CONTAINER_COUNT; i++) { short containerId = Utils.getRandomShort(random); String containerName = UUID.randomUUID().toString(); if (!containerIdSet.add(containerId) || !containerNameSet.add(containerName)) { i--; continue; } refContainerIds.add(containerId); refContainerNames.add(containerName); refContainerStatuses.add(random.nextBoolean() ? ContainerStatus.ACTIVE : ContainerStatus.INACTIVE); refContainerDescriptions.add(UUID.randomUUID().toString()); boolean encrypted = (i % 2 == 0); boolean previouslyEncrypted = encrypted || (i % 4 < 2); refContainerEncryptionValues.add(encrypted); refContainerPreviousEncryptionValues.add(previouslyEncrypted); refContainerCachingValues.add(random.nextBoolean()); refContainerMediaScanDisabledValues.add(random.nextBoolean()); if (refContainerReplicationPolicyValues.contains(null)) { refContainerReplicationPolicyValues.add(UtilsTest.getRandomString(10)); } else { refContainerReplicationPolicyValues.add(null); } refContainers.add(new Container(refContainerIds.get(i), refContainerNames.get(i), refContainerStatuses.get(i), refContainerDescriptions.get(i), refContainerEncryptionValues.get(i), refContainerPreviousEncryptionValues.get(i), refContainerCachingValues.get(i), refContainerMediaScanDisabledValues.get(i), refContainerReplicationPolicyValues.get(i), refAccountId)); containerJsonList.add(buildContainerJson(refContainers.get(i))); } }