1 Reply Latest reply on Aug 18, 2009 10:16 AM by Sai Krishna Mohan Susarla

    Custom Converters are not called from FacesRequest SeamTest

    Sai Krishna Mohan Susarla Newbie

      I have written a Custom Converter


      following is the code snippet:


      <ice:inputText value="MyController.age">
      <f:converter converterId="MyConverter"/>
      </ice:inputText>



      Here MyController.age is of Integer Type.  Hence, if I give characters in this field then my converter should be called.


      Now, I am writing a SeamTest.  Here is the code snippet:


      @Test(groups = "integration")
          public void testAge() throws Exception
          {
              new FacesRequest("/myPage.xhtml")
              {
                  @Override
                  protected void applyRequestValues() throws Exception
                  {
                      setValue("#{MyController.age}", "Invalid Data");
                  }
                  @Override
                  protected void updateModelValues() throws Exception
                  {
                  }
      
                  @Override
                  protected void renderResponse() throws Exception
                  {
                      Object age = getValue("#{MyController.age}");
                      assert "Invalid Data".equalsIgnoreCase(age.toString());
                  }
      
              }.run();
      
          }



      When i run this test my converter is not being called, instead it is giving me an exception as follows:


      java.lang.AssertionError: javax.el.ELException: Can't set property 'age' on class 'MyConverter' to value 'Invalid Data'.
         [testng]      at org.jboss.seam.mock.AbstractSeamTest$Request.onException(AbstractSeamTest.java:455)
         [testng]      at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:504)
         [testng]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
         [testng]      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
         [testng]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
         [testng]      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
         [testng]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
         [testng]      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
         [testng]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
         [testng]      at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
         [testng]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
         [testng]      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
         [testng]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
         [testng]      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
         [testng]      at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)
         [testng]      at com.octanner.materialmaster.MyController.testAge(MyController.java:4)




      Can some body tell me how to invoke my custom converter from SeamTest?