### Question:
TelemetryConverter { public TelemetryRequest convertToRequest(Telemetry telemetry) { TelemetryRequest telemetryRequest = new TelemetryRequest(); if (telemetry != null) { LoggingRequest loggingRequest = createLoggingRequestFromSource(telemetry); WorkloadAnalyticsRequest waRequest = createWorkloadAnalyticsRequestFromSource(telemetry); FeaturesRequest featuresRequest = createFeaturesRequestFromSource(telemetry); telemetryRequest.setWorkloadAnalytics(waRequest); telemetryRequest.setLogging(loggingRequest); telemetryRequest.setFluentAttributes(telemetry.getFluentAttributes()); telemetryRequest.setFeatures(featuresRequest); } return telemetryRequest; } TelemetryConverter(TelemetryConfiguration configuration,
            @Value("${cb.cm.telemetrypublisher.enabled:false}") boolean telemetryPublisherEnabled,
            @Value("${cb.cm.telemetrypublisher.default:true}") boolean telemetryPublisherDefaultValue); TelemetryResponse convert(Telemetry telemetry); Telemetry convert(TelemetryRequest request, StackType type); TelemetryRequest convert(TelemetryResponse response,
            SdxClusterResponse sdxClusterResponse); TelemetryRequest convertToRequest(Telemetry telemetry); Optional<FeatureSetting> createWorkloadAnalyticsFeature(WorkloadAnalyticsRequest waRequest); WorkloadAnalyticsRequest createWorkloadAnalyticsRequest(TelemetryResponse response,
            SdxClusterResponse sdxClusterResponse);  }### Answer:
@Test public void testConvertToRequest() { Telemetry telemetry = new Telemetry(); telemetry.setDatabusEndpoint(DATABUS_ENDPOINT); Logging logging = new Logging(); logging.setS3(new S3CloudStorageV1Parameters()); telemetry.setLogging(logging); Features features = new Features(); features.addClusterLogsCollection(true); telemetry.setFeatures(features); WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics(); Map<String, Object> waAttributes = new HashMap<>(); waAttributes.put("myWAKey", "myWAValue"); workloadAnalytics.setAttributes(waAttributes); telemetry.setWorkloadAnalytics(workloadAnalytics); Map<String, Object> fluentAttributes = new HashMap<>(); fluentAttributes.put("myKey", "myValue"); telemetry.setFluentAttributes(fluentAttributes); TelemetryRequest result = underTest.convertToRequest(telemetry); assertNotNull(result.getLogging().getS3()); assertEquals("myValue", result.getFluentAttributes().get("myKey")); assertEquals("myWAValue", result.getWorkloadAnalytics().getAttributes().get("myWAKey")); assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled()); }
@Test public void testConvertToRequestWithEmptyTelemetry() { Telemetry telemetry = new Telemetry(); TelemetryRequest result = underTest.convertToRequest(telemetry); assertNotNull(result); assertNull(result.getLogging()); assertNull(result.getWorkloadAnalytics()); assertNull(result.getFeatures()); }