@parameters in Junit 4

annotations, junit, junit4

Solution

You can use the Theories runner (search for the word theories at that link) to pass different parameters to different methods.

Problem

Can I have more than one method with @Parameters in junit test class which is running with Parameterized class ? ``` @RunWith(value = Parameterized.class) public class JunitTest6 { private String str; public JunitTest6(String region, String coverageKind, String majorClass, Integer vehicleAge, BigDecimal factor) { this.str = region; } @Parameters public static Collection<Object[]> data1() { Object[][] data = {{some data}} return Arrays.asList(data); } @Test public void pushTest() { System.out.println("Parameterized str is : " + str); str = null; } @Parameters public static Collection<Object[]> data() { Object[][] data = {{some other data}} return Arrays.asList(data); } @Test public void pullTest() { System.out.println("Parameterized new str is : " + str); str = null; } } ```

Original source