As I understand, with JUnit 4.x and its annotation org.junit.runners.Parameterized
I can make my unit test "parameterized", meaning that for every set of params provided the entire unit test will be executed again, from scratch.
This approach limits me, since I can't create a "parameterized method", for example:
..
@Test
public void testValid(Integer salary) {
Employee e = new Employee();
e.setSalary(salary);
assertEqual(salary, e.getSalary());
}
@Test(expected=EmployeeInvalidSalaryException.class)
public void testInvalid(Integer salary) {
Employee e = new Employee();
e.setSalary(salary);
}
..
As seen in the example, I need two collections of parameters in one unit test. Is it possible to do in JUnit 4.x? It is possible in PHPUnit, for example.
ps. Maybe it's possible to realize such mechanism in some other unit-testing framework, not in JUnit?