### Question:
ParametersService { public BaseParameters saveParameters(Long environmentId, ParametersDto parametersDto) { return environmentService.findEnvironmentById(environmentId) .map(environment -> saveParameters(environment, parametersDto)) .orElseThrow(() -> new IllegalStateException("Environment was not found by id " + environmentId)); } ParametersService(BaseParametersRepository baseParametersRepository,
            Map<CloudPlatform, EnvironmentParametersConverter> environmentParamsConverterMap,
            EnvironmentService environmentService); @SuppressWarnings("unchecked") Optional<T> findByEnvironment(Long environmentId); BaseParameters saveParameters(Long environmentId, ParametersDto parametersDto); BaseParameters saveParameters(Environment environment, ParametersDto parametersDto); boolean isS3GuardTableUsed(String accountId, String cloudPlatform, String location, String dynamoTableName); void updateResourceGroupName(Environment environment, String resourceGroupName);  }### Answer:
@Test void saveParameters() { AwsParameters awsParameters = new AwsParameters(); when(environmentParamsConverterMap.get(any(CloudPlatform.class))).thenReturn(environmentParametersConverter); when(environmentParametersConverter.convert(any(Environment.class), any(ParametersDto.class))).thenReturn(awsParameters); when(baseParametersRepository.save(any())).thenReturn(awsParameters); Environment environment = new Environment(); environment.setAccountId("accountId"); environment.setCloudPlatform("AWS"); BaseParameters result = underTest.saveParameters(environment, ParametersDto.builder().build()); assertEquals(awsParameters, result); }