### Question:
StackRequestManifester { void addAzureIdbrokerMsiToTelemetry(Map<String, Object> fluentAttributes, StackV4Request stackRequest) { if (stackRequest.getCluster() != null && stackRequest.getCluster().getCloudStorage() != null && stackRequest.getCluster().getCloudStorage().getIdentities() != null) { List<StorageIdentityBase> identities = stackRequest.getCluster().getCloudStorage().getIdentities(); for (StorageIdentityBase identity : identities) { if (CloudIdentityType.ID_BROKER.equals(identity.getType()) && identity.getAdlsGen2() != null) { if (!fluentAttributes.containsKey(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI)) { String idBrokerInstanceMsi = identity.getAdlsGen2().getManagedIdentity(); LOGGER.info("Setting idbroker instance msi for telemetry: {}", idBrokerInstanceMsi); fluentAttributes.put(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI, idBrokerInstanceMsi); } } } } }  void configureStackForSdxCluster(SdxCluster sdxCluster, DetailedEnvironmentResponse environment);  }### Answer:
@Test public void testAddAzureIdbrokerMsiToTelemetry() { Map<String, Object> attributes = new HashMap<>(); CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); List<StorageIdentityBase> identities = new ArrayList<>(); StorageIdentityBase identity = new StorageIdentityBase(); identity.setType(CloudIdentityType.ID_BROKER); AdlsGen2CloudStorageV1Parameters adlsGen2 = new AdlsGen2CloudStorageV1Parameters(); adlsGen2.setManagedIdentity("msi"); identity.setAdlsGen2(adlsGen2); identities.add(identity); cloudStorageRequest.setIdentities(identities); when(stackV4Request.getCluster()).thenReturn(clusterV4Request); clusterV4Request.setCloudStorage(cloudStorageRequest); underTest.addAzureIdbrokerMsiToTelemetry(attributes, stackV4Request); assertThat(clusterV4Request.getCloudStorage()).isNotNull(); assertThat(attributes.get(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI)).isEqualTo("msi"); }
@Test public void testAddAzureIdbrokerMsiToTelemetryWithoutCloudStorage() { Map<String, Object> attributes = new HashMap<>(); underTest.addAzureIdbrokerMsiToTelemetry(attributes, stackV4Request); assertThat(clusterV4Request.getCloudStorage()).isNull(); assertThat(attributes.size()).isEqualTo(0); }