I would like to write JUnit 5 parametrized test which takes string array (String[]
) as a parameter:
Use the Arguments.of()
factory from org.junit.jupiter.params.provider.Arguments
to wrap your arguments:
static Stream stringArrayProvider() {
return Stream.of(
Arguments.of((Object) new String[]{"1", "2"}),
Arguments.of((Object) new String[]{"1", "2", "3"})
);
}
For details see http://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests