0 Replies Latest reply on Sep 21, 2009 7:53 AM by piotr.sobczyk

    Exception from RichFaces code when running Seam integration

    piotr.sobczyk

      I'm using Seam 2.1.2 and JBossTools and I'm trying to run integration tests on Eclipse TestNG plugin.

      Test is running correctly but test report informs me that this exception has taken place:

      java.lang.NullPointerException
       at java.lang.String.startsWith(Unknown Source)
       at java.lang.String.startsWith(Unknown Source)
       at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:189)
       at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:222)
       at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:139)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)
       at pl.sobczyk.mitsubishi.crm.test.orderSelectorControllerTest.test_clientFinalisation(orderSelectorControllerTest.java:28)
      ... Removed 22 stack frames
      


      Example of the simplies test classes I am using:



      public class WelcomeTest extends SeamTest {
      
       @Test
       public void test_welcome() throws Exception {
       new FacesRequest() {
       @Override
       protected void updateModelValues() throws Exception {
       //set form input to model attributes
       setValue("#{welcome.value}", "seam");
       }
       @Override
       protected void invokeApplication() {
       //call action methods here
       invokeMethod("#{welcome.welcome}");
       }
       @Override
       protected void renderResponse() {
       //check model attributes if needed
       assert getValue("#{welcome.value}").equals("seam");
       }
       }.run();
       }
      }


      In pair with simple test suite:

      <!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
      
      <suite name="Welcome Tests" verbose="2" parallel="false">
       <test name="Welcome Test">
       <classes>
       <class name="pl.sobczyk.mitsubishi.crm.test.WelcomeTest"/>
       </classes>
       </test>
      </suite>


      The exception that occurs is burried in RichFaces code, and it's a bit too much for a developer to debug RichFaces code just in order to run integration test :(.