### Question:
EnvironmentApiConverter { public EnvironmentEditDto initEditDto(EnvironmentEditRequest request) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentEditDto.EnvironmentEditDtoBuilder builder = EnvironmentEditDto.builder() .withDescription(request.getDescription()) .withAccountId(accountId) .withIdBrokerMappingSource(request.getIdBrokerMappingSource()) .withCloudStorageValidation(request.getCloudStorageValidation()) .withAdminGroupName(request.getAdminGroupName()); NullUtil.doIfNotNull(request.getNetwork(), network -> builder.withNetwork(networkRequestToDto(network))); NullUtil.doIfNotNull(request.getAuthentication(), authentication -> builder.withAuthentication(authenticationRequestToDto(authentication))); NullUtil.doIfNotNull(request.getTelemetry(), telemetryRequest -> builder.withTelemetry(telemetryApiConverter.convert(request.getTelemetry(), accountTelemetryService.getOrDefault(accountId).getFeatures()))); NullUtil.doIfNotNull(request.getSecurityAccess(), securityAccess -> builder.withSecurityAccess(securityAccessRequestToDto(securityAccess))); NullUtil.doIfNotNull(request.getAws(), awsParams -> builder.withParameters(awsParamsToParametersDto(awsParams, null))); return builder.build(); } EnvironmentApiConverter(TelemetryApiConverter telemetryApiConverter,
            TunnelConverter tunnelConverter,
            AccountTelemetryService accountTelemetryService,
            CredentialService credentialService,
            FreeIpaConverter freeIpaConverter,
            NetworkRequestToDtoConverter networkRequestToDtoConverter); EnvironmentCreationDto initCreationDto(EnvironmentRequest request); EnvironmentEditDto initEditDto(EnvironmentEditRequest request); EnvironmentChangeCredentialDto convertEnvironmentChangeCredentialDto(EnvironmentChangeCredentialRequest request); EnvironmentCrnResponse crnResponse(String environmentName, String crn); EnvironmentFeatures convertToEnvironmentTelemetryFeatures(FeaturesRequest featuresRequest);  }### Answer:
@Test void testInitEditDto() { EnvironmentEditRequest request = createEditEnvironmentRequest(); EnvironmentTelemetry environmentTelemetry = mock(EnvironmentTelemetry.class); AccountTelemetry accountTelemetry = mock(AccountTelemetry.class); Features features = mock(Features.class); NetworkDto networkDto = mock(NetworkDto.class); when(accountTelemetry.getFeatures()).thenReturn(features); when(accountTelemetryService.getOrDefault(any())).thenReturn(accountTelemetry); when(telemetryApiConverter.convert(eq(request.getTelemetry()), any())).thenReturn(environmentTelemetry); when(networkRequestToDtoConverter.convert(request.getNetwork())).thenReturn(networkDto); EnvironmentEditDto actual = underTest.initEditDto(request); assertEquals("test-aws", actual.getAccountId()); assertEquals(request.getDescription(), actual.getDescription()); assertEquals(environmentTelemetry, actual.getTelemetry()); assertAuthentication(request.getAuthentication(), actual.getAuthentication()); assertEquals(request.getAdminGroupName(), actual.getAdminGroupName()); assertSecurityAccess(request.getSecurityAccess(), actual.getSecurityAccess()); verify(accountTelemetry).getFeatures(); verify(accountTelemetryService).getOrDefault(any()); verify(telemetryApiConverter).convert(eq(request.getTelemetry()), any()); verify(networkRequestToDtoConverter).convert(request.getNetwork()); }