CDI-Unit FAQ

To post a question use the comment form at the bottom of the page.

Q: Is CDI-Unit duplicating the unit testing effort at Arquillian?

A: There is some overlap. However, Arquillian is better when you want to test your code works in a variety of web servers.

Q: Can you use CDI unit with JUnit @Rule?

A: Yes. But you have to specify your rules as methods:

@RunWith(CdiRunner.class) // Runs the test with CDI-Unit
class MyTest {
  @Rule
  public TestName getTestName() {
    return new TestName();
  }
}

Post to Twitter