1 Reply Latest reply on May 13, 2009 3:55 PM by Fabrice Sommavilla

    ComponentTest() cause NPE in unit test

    Fabrice Sommavilla Newbie

      Hi all,
      I want to implements unit tests in my application, but when I declare the components test in the test method like the following:


      new ComponentTest() {
      
         @Override
         protected void testComponents() throws Exception {
           ...
         }
      }.run();



      I get this exception:


      java.lang.NullPointerException
           at org.jboss.seam.servlet.ServletApplicationMap.get(ServletApplicationMap.java:54)
           at org.jboss.seam.contexts.BasicContext.get(BasicContext.java:49)
           at org.jboss.seam.contexts.BasicContext.get(BasicContext.java:44)
           at org.jboss.seam.core.Init.instance(Init.java:117)
           at org.jboss.seam.contexts.BusinessProcessContext.<init>(BusinessProcessContext.java:47)
           at org.jboss.seam.contexts.TestLifecycle.beginTest(TestLifecycle.java:35)
           at org.jboss.seam.mock.AbstractSeamTest$ComponentTest.run(AbstractSeamTest.java:159)
           at org.mobyview.platform.crm.session.TestCivilityManagerAction.testIsCivilityUsedAnywhere(TestCivilityManagerAction.java:25)
      



      Any idees how to solve this ?


      I'm using maven 2 and seam 2.1.


      Thx,