I have a JUnit-Test that looks like this:
private final User user1;
private final User user2;
public UserTest(User user1, User user2) {
this.user1 = user1;
this.user2 = user2;
}
@Parameterized.Parameters
public static Collection<Object[]> userData() {
return Arrays.asList(new Object[][] {
{ new User("Tim", "Burton", "tim.burton"),
new User("tim", "burton", "timothy.burton") },
{ new User("Vincent", "van Gogh", "vincent.van.gogh"),
new User("vincent", "van-gogh", "vincent.vangogh") } });
}
@Test
public void testPositive() {
checkMatching(user1, user2);
}
Now all the tests are successful, but I want to create a second List of @Parameterized.Parameters for the negative tests. The new method should look like this:
@Test
public void testNegative() {
checkFalseMatching(wrongUser1, wrongUser2);
}
Is it possible to use a method-specific parameters? I would use the parameters I've already created for the testPositive() method and the second list of parameters for the testNegative() method.
How can I do that? Can I use a "scope" for my parameters or something similar?