Well, the thing is, if you run inside MC, you would have to mock out the EM 
*inside* the MC. This is very easy to do with a plain MC, but not really with 
EEJB.

I would try asking in the EJB3 forum, perhaps I am missing something.

But I really think it is very wierd to mock the database in integration tests. 
It is much, much better to actually test that the data is getting all the way 
to the db.


Now for *unit* tests, all you do is just create an EM and set the attribute of 
your bean. Its trivial.

  LoginAction la = new LoginAction();
  la.setEntityManager(mockEntityManager);
  la.login();

or whatever.

If you are using instvar injection rather than setter injection, just use 
reflection to do it.

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to