[jboss-user] [JBoss Seam] - Unit Testing With TestNG
djfjboss
do-not-reply at jboss.com
Wed Nov 28 06:34:07 EST 2007
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
More information about the jboss-user
mailing list