When I try to test my (simple) application using TestNG, variables that are 
automatically bijected when running outside of the test environment (such as 
instances of EntityManager, FacesMessages and Log) are no longer created 
automatically.

EntityManager can be fixed via:
                EntityManagerFactory emf = 
Persistence.createEntityManagerFactory("proj3");
  |             emf.createEntityManager();
  |             EntityManager em = emf.createEntityManager();
  |             setField(action, "entityManager", em);

Log can be fixed via:
setField(action, "log", LogFactory.getLog(DummyTest.class));

But trying to fix FacesMessages via:
setField(action, "facesMessages", FacesMessages.instance());
results in an IllegalStateException, stating that there is no active 
conversation context.

What is the correct way to deal with such issues?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108394#4108394

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108394
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to