[jboss-user] [JBoss Seam] - unit tests in a seam-genned app
matt.drees
do-not-reply at jboss.com
Sat Feb 3 13:23:46 EST 2007
I seam-genned a blank app (called booking), then seam-genned a form (RegisterAction). I wanted to create a unit test (as in the Seam docs (http://docs.jboss.com/seam/1.1.5.GA/reference/en/html/testing.html#d0e13075)), so I copy/pasted the code and tweaked some things:
| public class RegisterActionTest {
|
| @Test
| public void testRegisterAction()
| {
| }
|
| private EntityManagerFactory emf;
|
| public EntityManagerFactory getEntityManagerFactory()
| {
| return emf;
| }
|
| @Configuration(beforeTestClass=true)
| public void initialize()
| {
| emf = Persistence.createEntityManagerFactory("booking");
| }
|
| @Configuration(afterTestClass=true)
| public void destroy()
| {
| emf.close();
| }
| }
|
Running "ant test" gives me a javax.naming.NamingException: Local server is not initialized error in initialize().
If I extend SeamTest (which I think shouldn't be necessary for a unit test), I get a java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException in initialize().
I think Seam-gen must not be including an EHCache jar, but I couldn't find where it is supposed to come from (or why the seam-genned integration test doesn't fail).
Also, should unit tests be required to extend SeamTest?
I'm running Seam from cvs.
Thanks for your help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010462#4010462
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010462
More information about the jboss-user
mailing list