3 Replies Latest reply on Jul 5, 2009 9:03 PM by John Smith

    TestNG of Seam email fails

    Alex Cougarman Apprentice

      I've got this code for testing a Seam email:




      package org.unctv.metaform.session;
      
      import javax.mail.internet.MimeMessage;
      
      import org.jboss.seam.mock.SeamTest;
      import org.testng.annotations.Test;
      
      public class MetaformTest extends SeamTest{
           @Test
           public void testEmail() throws Exception{
                new FacesRequest() {
                     @Override
                     protected void invokeApplication() throws Exception{
                          MimeMessage renderedMessage = getRenderedMailMessage("/mail.xhtml");
                          assert renderedMessage.getAllRecipients().length == 1;
                     }
                }.run();
           }
      }



      I right-click this file in Eclipse and choose Run As TestNG, and it displays this message:




      [Parser] Running:
        C:\Documents and Settings\acougar\workspace\metaform\temp-testng-customsuite.xml
      
      FAILED: testEmail
      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:500)
           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:58)
           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 org.unctv.metaform.session.MetaformTest.testEmail(MetaformTest.java:17)
      ... Removed 22 stack frames
      
      ===============================================
          org.unctv.metaform.session.MetaformTest
          Tests run: 1, Failures: 1, Skips: 0
      ===============================================
      
      
      ===============================================
      metaform
      Total tests run: 1, Failures: 1, Skips: 0
      ===============================================
      
      



      What am I doing wrong in trying to test the Seam email file mail.xhtml? Thanks.