Source:
public void testContainerBuilder() throws JSONException { for (int i = 0; i < CONTAINER_COUNT; i++) { ContainerBuilder containerBuilder = new ContainerBuilder(refContainerIds.get(i), refContainerNames.get(i), refContainerStatuses.get(i), refContainerDescriptions.get(i), refAccountId).setEncrypted(refContainerEncryptionValues.get(i)) .setPreviouslyEncrypted(refContainerPreviousEncryptionValues.get(i)) .setCacheable(refContainerCachingValues.get(i)) .setMediaScanDisabled(refContainerMediaScanDisabledValues.get(i)) .setReplicationPolicy(refContainerReplicationPolicyValues.get(i)) .setTtlRequired(refContainerTtlRequiredValues.get(i)) .setCloudConfigs(refContainerCloudReplicationConfigValues); Container containerFromBuilder = containerBuilder.build(); assertContainer(containerFromBuilder, i); containerBuilder = new ContainerBuilder(containerFromBuilder); containerFromBuilder = containerBuilder.build(); assertContainer(containerFromBuilder, i); boolean previouslyEncrypted = containerFromBuilder.wasPreviouslyEncrypted(); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(false).build(); assertEncryptionSettings(containerFromBuilder, false, previouslyEncrypted); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(true).setEncrypted(false).build(); assertEncryptionSettings(containerFromBuilder, false, previouslyEncrypted); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(true).build(); assertEncryptionSettings(containerFromBuilder, true, true); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(false).build(); assertEncryptionSettings(containerFromBuilder, false, true); } }

Target:
public void testContainerBuilder() throws JSONException { for (int i = 0; i < CONTAINER_COUNT; i++) { ContainerBuilder containerBuilder = new ContainerBuilder(refContainerIds.get(i), refContainerNames.get(i), refContainerStatuses.get(i), refContainerDescriptions.get(i), refAccountId).setEncrypted(refContainerEncryptionValues.get(i)) .setPreviouslyEncrypted(refContainerPreviousEncryptionValues.get(i)) .setCacheable(refContainerCachingValues.get(i)) .setMediaScanDisabled(refContainerMediaScanDisabledValues.get(i)) .setReplicationPolicy(refContainerReplicationPolicyValues.get(i)) .setTtlRequired(refContainerTtlRequiredValues.get(i)) .setCloudConfigs(Collections.singletonList(refContainerCloudReplicationConfigValues.get(i))); Container containerFromBuilder = containerBuilder.build(); assertContainer(containerFromBuilder, i); containerBuilder = new ContainerBuilder(containerFromBuilder); containerFromBuilder = containerBuilder.build(); assertContainer(containerFromBuilder, i); boolean previouslyEncrypted = containerFromBuilder.wasPreviouslyEncrypted(); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(false).build(); assertEncryptionSettings(containerFromBuilder, false, previouslyEncrypted); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(true).setEncrypted(false).build(); assertEncryptionSettings(containerFromBuilder, false, previouslyEncrypted); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(true).build(); assertEncryptionSettings(containerFromBuilder, true, true); containerFromBuilder = new ContainerBuilder(containerFromBuilder).setEncrypted(false).build(); assertEncryptionSettings(containerFromBuilder, false, true); } }