### Question:
CloudStorageValidationUtil { public boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (cloudStorageRequest != null) { if (CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities())) { return false; } if (!containsOnlyLogIdentity(cloudStorageRequest.getIdentities())) { validationBuilder.ifError(() -> CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities()), "Either 'locations' or 'identities' in 'cloudStorage' must not be empty!"); } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } return true; } else { return false; } }  boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest);  }### Answer:
@Test public void testIsCloudStorageConfiguredWhenCloudStorageNull() { boolean actual = underTest.isCloudStorageConfigured(null); Assert.assertFalse(actual); }
@Test public void testIsCloudStorageConfiguredWhenCloudStorageNotNull() { boolean actual = underTest.isCloudStorageConfigured(new CloudStorageRequest()); Assert.assertFalse(actual); }
@Test public void testIsCloudStorageConfiguredWhenAdlsNotNull() { CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); StorageIdentityBase storageIdentityBase = new StorageIdentityBase(); storageIdentityBase.setAdls(new AdlsCloudStorageV1Parameters()); cloudStorageRequest.setIdentities(List.of(storageIdentityBase)); cloudStorageRequest.setLocations(List.of(new StorageLocationBase())); boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest); Assert.assertTrue(actual); }
@Test public void testIsCloudStorageConfiguredWhenWasbNotNull() { CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); StorageIdentityBase storageIdentityBase = new StorageIdentityBase(); storageIdentityBase.setWasb(new WasbCloudStorageV1Parameters()); cloudStorageRequest.setIdentities(List.of(storageIdentityBase)); cloudStorageRequest.setLocations(List.of(new StorageLocationBase())); boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest); Assert.assertTrue(actual); }
@Test public void testIsCloudStorageConfiguredWhenAdlsGen2NotNull() { CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); StorageIdentityBase storageIdentityBase = new StorageIdentityBase(); storageIdentityBase.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters()); cloudStorageRequest.setIdentities(List.of(storageIdentityBase)); cloudStorageRequest.setLocations(List.of(new StorageLocationBase())); boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest); Assert.assertTrue(actual); }
@Test public void testIsCloudStorageConfiguredWhenS3NotNull() { CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); StorageIdentityBase storageIdentityBase = new StorageIdentityBase(); storageIdentityBase.setS3(new S3CloudStorageV1Parameters()); cloudStorageRequest.setIdentities(List.of(storageIdentityBase)); cloudStorageRequest.setLocations(List.of(new StorageLocationBase())); boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest); Assert.assertTrue(actual); }
@Test public void testIsCloudStorageConfiguredWhenGcsNotNull() { CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); StorageIdentityBase storageIdentityBase = new StorageIdentityBase(); storageIdentityBase.setGcs(new GcsCloudStorageV1Parameters()); cloudStorageRequest.setIdentities(List.of(storageIdentityBase)); cloudStorageRequest.setLocations(List.of(new StorageLocationBase())); boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest); Assert.assertTrue(actual); }