### Question:
CustomConverterExtractor implements ParameterConverterExtractor<Method> { public Optional<Parameter.Converter>[] extract(final Method method) { return Arrays.stream(method.getParameters()) .map(CustomConverterExtractor::extractParameter) .toArray(Optional[]::new); }  Optional<Parameter.Converter>[] extract(final Method method);  }### Answer:
@Test public void methodWithoutParameters() { final Method method; final Optional<Parameter.Converter>[] converters; given: method = retrieveMethod("methodWithoutParameters"); when: converters = this.extractor.extract(method); then: assertThat(converters) .as("A method without parameter should skip and return an empty array.") .isEmpty(); }
@Test public void methodWithoutConverters() { final Method method; final Optional<Parameter.Converter>[] converters; given: method = retrieveMethod("methodWithoutConverters"); when: converters = this.extractor.extract(method); then: assertThat(converters) .as( "A method with parameters should return an array with the respective number of null items.") .hasSize(3) .containsExactly(Optional.empty(), Optional.empty(), Optional.empty()); }
@Test public void methodWithConverter() { final Method method; final Optional<Parameter.Converter>[] converters; given: method = retrieveMethod("methodWithConverter"); when: converters = this.extractor.extract(method); then: assertThat(converters) .as("An array with the respective number of parameters should be returned.") .hasSize(2) .as("The parameters without converters should be empty.") .containsExactly(Optional.empty(), Optional.of(new DummyConverter())); }
@Test public void invalidConstructor() { final Method method; final Optional<Parameter.Converter>[] converters; given: method = retrieveMethod("invalidModifierConstructor"); when: converters = this.extractor.extract(method); then: assertThat(converters) .as("An array with the respective number of empties should be returned.") .hasSize(2) .as("Converters with invalid constructors should return empty.") .containsExactly(Optional.empty(), Optional.empty()); }
@Test public void explodingConstructor() { final Method method; final Optional<Parameter.Converter>[] converters; given: method = retrieveMethod("explodingConstructor"); when: converters = this.extractor.extract(method); then: assertThat(converters) .as("An array with the respective number of empties should be returned.") .hasSize(1) .as("Any exception during the instantiation of a converter should return empty.") .containsExactly(Optional.empty()); }