### Question:
EnvironmentModificationService { public EnvironmentDto editByCrn(String crn, EnvironmentEditDto editDto) { Environment env = environmentService .findByResourceCrnAndAccountIdAndArchivedIsFalse(crn, editDto.getAccountId()) .orElseThrow(() -> new NotFoundException(String.format("No environment found with crn '%s'", crn))); return edit(editDto, env); } 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 void editByCrn() { EnvironmentEditDto environmentDto = EnvironmentEditDto.builder() .withAccountId(ACCOUNT_ID) .build(); when(environmentService .findByResourceCrnAndAccountIdAndArchivedIsFalse(eq(CRN), eq(ACCOUNT_ID))).thenReturn(Optional.of(new Environment())); environmentModificationServiceUnderTest.editByCrn(CRN, environmentDto); verify(environmentService).save(any()); }