1 Reply Latest reply on Apr 5, 2008 5:42 PM by Pete Muir

    I got IllegalArgumentException using SeamTest when @Begin method

    chen liang Newbie

      My test code is below


      public class MenuCtrlTest extends SeamTest {
           @Test
           public void testLevOne() throws Exception {
                new ComponentTest() {
                     protected void testComponents() throws Exception {
                                    assert (Integer)getValue("#{menuCtrl.getLevOneMenuItemList().size()}") == 0; 
                     }
                }.run();
           }
      }



      getLevOneMenuItemList() is annotated @Begin , when I run test ,it throws this exception:


      FAILED: testLevOne
         [testng] java.lang.IllegalArgumentException: Stack must not be null
         [testng]      at org.jboss.seam.core.ConversationEntry.<init>(ConversationEntry.java:39)
         [testng]      at org.jboss.seam.core.ConversationEntries.createConversationEntry(ConversationEntries.java:53)
         [testng]      at org.jboss.seam.core.Manager.createConversationEntry(Manager.java:541)
         [testng]      at org.jboss.seam.core.Manager.beginConversation(Manager.java:562)
         [testng]      at org.jboss.seam.core.ConversationInterceptor.beginConversation(ConversationInterceptor.java:229)
         [testng]      at org.jboss.seam.core.ConversationInterceptor.beginConversationIfNecessary(ConversationInterceptor.java:166)
         [testng]      at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:57)
         [testng]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
         [testng]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
         [testng]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
         [testng]      at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
         [testng]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
         [testng]      at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
         [testng]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
         [testng]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
         [testng]      at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
         [testng]      at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
         [testng]      at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
         [testng]      at org.jboss.ejb3.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:110)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:86)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
         [testng]      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
         [testng]      at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:261)
         [testng]      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
         [testng]      at $Proxy91.getLevOneMenuItemList(Unknown Source)
         [testng]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
         [testng]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
         [testng]      at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
         [testng]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
         [testng]      at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
         [testng]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
         [testng]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
         [testng]      at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
         [testng]      at org.javassist.tmp.java.lang.Object_$$_javassist_0.getLevOneMenuItemList(Object_$$_javassist_0.java)
         [testng]      at net.coms.action.users.test.MenuCtrlTest$1.testComponents(MenuCtrlTest.java:17)
         [testng]      at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:169)
         [testng]      at net.coms.action.users.test.MenuCtrlTest.testLevOne(MenuCtrlTest.java:20)
         [testng] ... Removed 30 stack frames



      then I remove @Begin of getLevOneMenuItemList() , test will be success.
      My question is how to test, when it is a @Begin method?