In JUnit 4, I use the following setup to test my EJB beans:
@RunWith(EJBContainerRunner.class)
public class MyEETestWithOneOpenEJB {
@Inject
private ACdiBean bean;
@Test
public void theTest() {
// do test
}
}
But in JUnit 5, there is no @RunWith(...)
anymore.
Question: How to test with JUnit 5?
You will need to write your own EJBContainerExtension to replace the Runner or find an already existing one. The latter is unfortunately not very likely at this moment, JUnit5 is still not in GA and there are not many official extensions yet.