1 Reply Latest reply on Dec 26, 2007 5:53 PM by Pete Muir

    Integration Testing Seam Mail

    Darek B Newbie

      Hello.

      I'm trying run a test from Pete Muir blog site about testing seam email.
      Test code example

      public class EmailAktywacyjnyTest extends SeamTest {
      
       @Test
       public void testowanieWiadomosci() throws Exception {
       new FacesRequest() {
       @Override
       protected void invokeApplication() throws Exception {
       MimeMessage renderedMessage = getRenderedMailMessage("/emailAktywacyjny.xhtml");
       assert renderedMessage.getAllRecipients().length == 1;
       InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
       assert to.getAddress().equals("test@example.com");
       }
       }.run();
       }
      }
      


      I get error in line :

      MimeMessage renderedMessage = getRenderedMailMessage("/emailAktywacyjny.xhtml");



      FAILED: testowanieWiadomosci
      java.lang.AssertionError: java.lang.NullPointerException
       at org.jboss.seam.mock.BaseSeamTest$Request.onException(BaseSeamTest.java:475)
       at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:526)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
       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.BaseSeamTest$Request.run(BaseSeamTest.java:514)
       at pl.fotowycieczkatest.EmailAktywacyjnyTest.testowanieWiadomosci(EmailAktywacyjnyTest.java:14)
      Caused by: java.lang.NullPointerException
       at org.jboss.seam.mock.BaseSeamTest$Request.getRenderedMailMessage(BaseSeamTest.java:820)
       at pl.fotowycieczkatest.EmailAktywacyjnyTest$1.invokeApplication(EmailAktywacyjnyTest.java:17)
       at org.jboss.seam.mock.BaseSeamTest$Request.invokeApplicationPhase(BaseSeamTest.java:652)
       at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:598)
       at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:185)
       at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:519)
       ... 36 more
      ... Removed 22 stack frames
      
      


      Could anyone tell me, what is wrong?


      Thanks, poiu77