### Question:
CmMgmtServiceConfigLocationService implements CmConfigServiceDelegate { @Override public void setConfigs(Stack stack, ApiRoleList apiRoleList) { Optional<ApiRole> eventServer = getApiRole("EVENTSERVER", apiRoleList); eventServer.ifPresent(apiRole -> addConfig(apiRole, createApiConfig("eventserver_index_dir", buildSingleVolumePath(1, "cloudera-scm-eventserver")))); Optional<ApiRole> hostMonitor = getApiRole("HOSTMONITOR", apiRoleList); hostMonitor.ifPresent(apiRole -> addConfig(apiRole, createApiConfig("firehose_storage_dir", buildSingleVolumePath(1, "cloudera-host-monitor")))); Optional<ApiRole> reportsManager = getApiRole("REPORTSMANAGER", apiRoleList); reportsManager.ifPresent(apiRole -> addConfig(apiRole, createApiConfig("headlamp_scratch_dir", buildSingleVolumePath(1, "cloudera-scm-headlamp")))); Optional<ApiRole> serviceMonitor = getApiRole("SERVICEMONITOR", apiRoleList); serviceMonitor.ifPresent(apiRole -> addConfig(apiRole, createApiConfig("firehose_storage_dir", buildSingleVolumePath(1, "cloudera-service-monitor")))); }  @Override void setConfigs(Stack stack, ApiRoleList apiRoleList);  }### Answer:
@Test public void testSetConfigLocationsShouldSetLocationsWhenThereAreNoExistingConfig() { Stack stack = createStack(); ApiRoleList apiRoleList = createApiRoleListWithoutConfig(); underTest.setConfigs(stack, apiRoleList); assertEquals(VOLUME_PREFIX + "cloudera-scm-eventserver", getApiConfig(EVENTSERVER, "eventserver_index_dir", apiRoleList).getValue()); assertEquals(VOLUME_PREFIX + "cloudera-host-monitor", getApiConfig(HOSTMONITOR, "firehose_storage_dir", apiRoleList).getValue()); assertEquals(VOLUME_PREFIX + "cloudera-scm-headlamp", getApiConfig(REPORTSMANAGER, "headlamp_scratch_dir", apiRoleList).getValue()); assertEquals(VOLUME_PREFIX + "cloudera-service-monitor", getApiConfig(SERVICEMONITOR, "firehose_storage_dir", apiRoleList).getValue()); }
@Test public void testSetConfigLocationsShouldSetLocationsWhenThereAreExistingConfig() { Stack stack = createStack(); ApiRoleList apiRoleList = createApiRoleListWithOtherConfig(); underTest.setConfigs(stack, apiRoleList); assertEquals(VOLUME_PREFIX + "cloudera-scm-eventserver", getApiConfig(EVENTSERVER, "eventserver_index_dir", apiRoleList).getValue()); assertEquals(VOLUME_PREFIX + "cloudera-host-monitor", getApiConfig(HOSTMONITOR, "firehose_storage_dir", apiRoleList).getValue()); assertEquals(VOLUME_PREFIX + "cloudera-scm-headlamp", getApiConfig(REPORTSMANAGER, "headlamp_scratch_dir", apiRoleList).getValue()); assertEquals(VOLUME_PREFIX + "cloudera-service-monitor", getApiConfig(SERVICEMONITOR, "firehose_storage_dir", apiRoleList).getValue()); assertEquals(TEST_CONFIG_VALUE, getApiConfig(TEST_ROLE, TEST_CONFIG_NAME, apiRoleList).getValue()); }