Closed aaschmid closed 3 years ago
Simple but ugly workaround would be using List<List<UnaryOperator<String>>>
instead, e.g.:
@DataProvider
public static List<List<UnaryOperator<String>>> listOfListOfUnaryOperator() {
List<List<UnaryOperator<String>>> list = new ArrayList<>();
List<UnaryOperator<String>> list2 = new ArrayList<>();
list2.add((string) -> "merged-" + string);
list.add(list2);
return Collections.unmodifiableList(list);
}
@Test
@UseDataProvider("listOfListOfUnaryOperator")
public void testListOfListOfUnaryOperator(UnaryOperator<String> operator) {
assertThat(operator.apply("test")).isEqualTo("merged-test");
}
Overview
With the
junit4-dataprovider
in version 2.7 one cannot useList<UnaryOperator<...>>
as the@DataProvider
result because of the following exception while trying to calculate test cases:Reproducer:
Deliverables
core
orjunit-jupiter*
, respectively.Thanks for telling @Airblader :-)