I googled for solutions but to no avail.
public class Bean {
@EJB
private Session session;
public String register(String a, String b, String c) {
return session.create(a, b, c).toString();
}
and i have a test class
@Test
public void testRegister(String a, String b, String c) {
new MockUp<Bean>() {
@Mocked Session session;
};
System.out.println("session: "+ session);
Bean bean = new Bean ();
System.out.println("apiService: "+ bean);
System.out.println("bean.register: "+ bean.register("a", "b", "c"));
}
Im trying a few different ways for instanitating/injecting the EJB. But it all returned null. How do you inject the @EJB Session for testing of register method?
Aucun commentaire:
Enregistrer un commentaire