i am currently working on a Project with Tests in JUnit 4 and i should migrate them to JUnit 5. Now i have the Problem that i have a Parameterized test in JUnit 4. Lets say my test looks like this:
@RunWith(Parameterized.class)
public class FibonacciTest {
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{0,0},{1,1},{2,1},{3,2} })};
private int input, expected;
public FibonacciTest(int input, int expected) {
this.input = input; this.expected = expected;
}
@Test
public void test() {
assertEquals(expected, Fibonacci.compute(input));
}
}
I search already alot and also tried with a Stream Stream<Arguments> data()
and than i added my params with Arguments.of(1,1)
But Nothing really works for me.
Can i write JUnit4 tests like this in JUnit5 without changing the whole class?