### Question:
ExampleParametersResolver { private Optional<Object[]> resolveParameters( final Method testMethod, final Example.Builder example, final Parameter.Converter[] converters) { final Parameter.Convertible[] parameters = this.parameterConvertibleCreator.create(testMethod, example); if (converters.length != parameters.length) { LOGGER.error( "The size of the converters ({}) and method parameters ({}) does not match for {} in {}.", converters.length, parameters.length, testMethod.getName(), testMethod.getDeclaringClass()); return Optional.empty(); } return Optional.of( IntStream.range(0, converters.length) .mapToObj(i -> converters[i].convert(parameters[i])) .toArray(Object[]::new)); } ExampleParametersResolver(
      final ParameterConverterResolver parameterConverterResolver,
      final ParameterConvertibleCreator parameterConvertibleCreator); Optional<Object[]> resolve(final Method testMethod, final Example.Builder example);  }### Answer:
@Test public void resolveParameters() { final String firstParameterValue, secondParameterValue; final Parameter.Convertible firstParameter, secondParameter; final Parameter.Converter firstConverter; final Parameter.Converter secondConverter; final Optional<Object[]> conversions; final Example.Builder example; final Method testMethod; given: example = new Example.Builder( ExampleParametersResolverTest.class.getName(), "", Arrays.asList( ImmutableSchema.schema() .name("firstConverter") .overallOrder(0) .type(String.class) .step(Scenario.StepType.REQUISITE) .build(), ImmutableSchema.schema() .name("secondConverter") .overallOrder(1) .type(String.class) .step(Scenario.StepType.REQUISITE) .build())); firstParameterValue = "A"; secondParameterValue = "B"; example.setValue("firstConverter", firstParameterValue); example.setValue("secondConverter", secondParameterValue); testMethod = retrieveMethod("withParameters"); firstConverter = mock(Parameter.Converter.class, "firstConverter"); secondConverter = mock(Parameter.Converter.class, "secondConverter"); firstParameter = convertableParameter() .method(anyMethod()) .schema(anySchema()) .value(firstParameterValue) .build(); secondParameter = convertableParameter() .method(anyMethod()) .schema(anySchema()) .value(secondParameterValue) .build(); orchestrate: when(this.parameterConverterResolver.resolveConverters(testMethod, example)) .thenReturn( Optional.of( new Parameter.Converter[] { firstConverter, secondConverter, })); when(firstConverter.convert(firstParameter)).thenReturn("1"); when(secondConverter.convert(secondParameter)).thenReturn("2"); when(this.parameterConvertibleCreator.create(testMethod, example)) .thenReturn( new Parameter.Convertible[] { convertableParameter() .method(anyMethod()) .schema(anySchema()) .value(firstParameterValue) .build(), convertableParameter() .method(anyMethod()) .schema(anySchema()) .value(secondParameterValue) .build(), }); when: conversions = this.resolver.resolve(testMethod, example); then: Assertions.assertThat(conversions) .as("Both parameter values should have been converted.") .isPresent(); Assertions.assertThat(conversions.get()) .as("The converted parameter values matches the expected.") .containsExactly("1", "2"); verification: verify(this.parameterConverterResolver, times(1)).resolveConverters(testMethod, example); verify(firstConverter, times(1)).convert(firstParameter); verify(secondConverter, times(1)).convert(secondParameter); verify(this.parameterConvertibleCreator, times(1)).create(testMethod, example); verifyNoMoreInteractions(firstConverter, secondConverter); }