### Question:
EnvironmentModificationService { public EnvironmentDto changeTelemetryFeaturesByEnvironmentName(String accountId, String environmentName, EnvironmentFeatures features) { Environment environment = environmentService .findByNameAndAccountIdAndArchivedIsFalse(environmentName, accountId) .orElseThrow(() -> new NotFoundException(String.format("No environment found with name '%s'", environmentName))); return changeTelemetryFeatures(features, environment); } EnvironmentModificationService(EnvironmentDtoConverter environmentDtoConverter, EnvironmentService environmentService,
            CredentialService credentialService, NetworkService networkService, AuthenticationDtoConverter authenticationDtoConverter,
            ParametersService parametersService, EnvironmentFlowValidatorService environmentFlowValidatorService,
            EnvironmentResourceService environmentResourceService); EnvironmentDto editByName(String environmentName, EnvironmentEditDto editDto); EnvironmentDto editByCrn(String crn, EnvironmentEditDto editDto); EnvironmentDto changeCredentialByEnvironmentName(String accountId, String environmentName, EnvironmentChangeCredentialDto dto); EnvironmentDto changeCredentialByEnvironmentCrn(String accountId, String crn, EnvironmentChangeCredentialDto dto); EnvironmentDto changeTelemetryFeaturesByEnvironmentName(String accountId, String environmentName,
            EnvironmentFeatures features); EnvironmentDto changeTelemetryFeaturesByEnvironmentCrn(String accountId, String crn,
            EnvironmentFeatures features);  }### Answer:
@Test public void testChangeTelemetryFeaturesByEnvironmentName() { String accountId = "myAccountId"; String envName = "myEnvName"; EnvironmentFeatures featuresInput = new EnvironmentFeatures(); featuresInput.addClusterLogsCollection(true); Environment environment = new Environment(); environment.setTelemetry(new EnvironmentTelemetry()); when(environmentService.findByNameAndAccountIdAndArchivedIsFalse(envName, accountId)) .thenReturn(Optional.of(environment)); when(environmentService.save(environment)).thenReturn(environment); when(environmentDtoConverter.environmentToDto(environment)).thenReturn(new EnvironmentDto()); environmentModificationServiceUnderTest.changeTelemetryFeaturesByEnvironmentName(accountId, envName, featuresInput); verify(environmentService).save(any()); assertTrue(environment.getTelemetry().getFeatures().getClusterLogsCollection().isEnabled()); }