Well injection of logs is only saving you this:
public Log log = Logging.getLog(RegisterAndLoginTest.class);
|
I use this outside of SFSBs where unit testing is important.
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4045302#4045302
Reply to the post
mrobinson28 wrote :
| So my questions:
|
| | * From the exception it looks like I may have to provide more than I
am currently via something in org.jboss.seam.mock.* e.g currentUser (In the
application currentUser is a session scoped component that is instantiated when
a user logs
Yeah, I mock the log object in my unit tests to get around the fact that there
is no application context active. It looks like this, and seems to work ok:
| package org.uscm.crs.misc;
|
| import org.jboss.seam.log.Log;
| import org.jboss.seam.log.Logging;
|
| public class
Ok, in my unit test I originally had:
| EntityManager entityManager = emf.createEntityManager();
|
I have replaced it with:
| EntityManager entityManager = new EntityManagerProxy(
emf.createEntityManager() );
|
Now the exception is:
| java.lang.IllegalStateException: No
I've been using SeamTest in integration mode (I'm not using setField for
instance) and the em accepts seam parameters in EJB-QL.
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4036731#4036731
Reply to the post :
If you're using integration tests, Seam will proxy the EM.
If you're writing a unit test, and creating your own EM from an EMF, you need
to do:
EntityManager em = new EntityManagerProxy( emf.createEntityManager() );
View the original post :