[jboss-user] [JBoss Seam] - Re: TestNG entityMnager question

dkane do-not-reply at jboss.com
Sun Dec 2 10:13:52 EST 2007


I need to test Seam component that uses EntityManager. My test is based on "Simplicity and power beyond Java EE" book example : 

public class HelloWorldTest extends SeamTest 
  | {
  | 
  | @Test
  | public void unitTestSayHello() throws Exception 
  | {
  |   Manager manager = new ManagerAction ();
  |   EntityManagerFactory emf =
  |    Persistence.createEntityManagerFactory("helloworld");
  |   EntityManager em = emf.createEntityManager();
  |   setField(manager, "em", em);
  |   Person person = new Person ();
  |   person.setName ("Thomas Heute");
  |   setField(manager, "person", person);
  |   setField(manager, "confirmed", false);
  | 

The only difference in my case is initializing EntityManager in @BeforeClass method to use it in different @Test methods then. 

What is incorrect ? 




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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109640



More information about the jboss-user mailing list