### Question:
CloudBackupFolderResolverService { public Backup updateStorageLocation(Backup backup, String clusterType, String clusterName, String clusterCrn) { LOGGER.debug("Updating/enriching backup storage locations with cluster data."); if (backup != null && StringUtils.isNotEmpty(backup.getStorageLocation())) { String storageLocation = backup.getStorageLocation(); if (backup.getS3() != null) { storageLocation = resolveS3Location(storageLocation, clusterType, clusterName, clusterCrn); } else if (backup.getAdlsGen2() != null) { storageLocation = resolveAdlsGen2Location(storageLocation, clusterType, clusterName, clusterCrn); } else { LOGGER.warn("None of the backup storage location was resolved, " + "make sure storage type is set properly (currently supported: s3, abfs)"); } backup.setStorageLocation(storageLocation); } else { LOGGER.debug("Backup is not set, skipping cloud storage location updates."); } return backup; } CloudBackupFolderResolverService(S3BackupConfigGenerator s3BackupConfigGenerator,
            AdlsGen2BackupConfigGenerator adlsGen2BackupConfigGenerator); Backup updateStorageLocation(Backup backup, String clusterType,
            String clusterName, String clusterCrn); String resolveS3Location(String location, String clusterType,
            String clusterName, String clusterCrn); String resolveAdlsGen2Location(String location, String clusterType,
            String clusterName, String clusterCrn);  }### Answer:
@Test public void testUpdateStorageLocationS3() { Backup backup = createBackup(); underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("s3: }
@Test public void testUpdateStorageLocationAdlsGen2() { Backup backup = createBackup(); backup.setS3(null); backup.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters()); backup.setStorageLocation("abfs: underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("https: }
@Test public void testUpdateStorageLocationAdlsGen2WithoutScheme() { Backup backup = createBackup(); backup.setS3(null); backup.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters()); backup.setStorageLocation("mycontainer@someaccount"); underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("https: }
@Test public void testUpdateStorageLocationWithoutScheme() { Backup backup = createBackup(); backup.setStorageLocation("mybucket"); underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertEquals("s3: }
@Test public void testUpdateStorageLocationWithoutBackup() { Backup backup = null; underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345"); assertNull(backup); }
@Test(expected = CrnParseException.class) public void testUpdateStorageLocationWithInvalidCrn() { Backup backup = createBackup(); underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west:someone:stack:12345"); }