...
Pax Exam test annotations @Configuration, @ExamFactory, @ExamReactorStrategy now come from package org.ops4j.pax.exam so they can be shared with the TestNG driver. The old 2.x annotations from org.ops4j.pax.exam.junit are deprecated but still functional.
The JUnit runner is now called PaxExam. The old name JUnit4TestRunner is still working but deprecated.
Parameterized Tests
| Info |
|---|
Since 3.2.0. |
...
| Code Block |
|---|
import org.ops4j.pax.exam.junit.PaxExamParameterized;
@RunWith(PaxExamParameterized.class)
public class CalculatorTest {
@Inject
private Calculator calculator;
private int a;
private int b;
private int sum;
@Parameters
public static List<Object[]> getParameters() {
return Arrays.asList(new Object[][] {
{2, 3, 5},
{6, 2, 8}
});
}
public CalculatorTest(int a, int b, int sum) {
this.a = a;
this.b = b;
this.sum = sum;
}
@Test
public void add() {
assertThat(calculator.add(a, b), is(sum));
}
}
|
| Note |
|---|
For parameterized tests, the |