1 Reply Latest reply on Apr 10, 2007 4:38 PM by Matt Drees

    page parameters broken in integration tests?

    Matt Drees Master

      I think that page parameters do not work in integration tests.

      I have the following test:

      ItemTest.java

      public class ItemTest extends SeamTest {
      
       @Test
       public void testRequestParameterAnnotation() throws Exception {
       new NonFacesRequest("/item.xhtml") {
      
       @Override
       protected void beforeRequest() {
       setParameter("itemId", "1");
       }
      
       @Override
       protected void renderResponse() throws Exception {
       checkItemRetrieval(getValue("#{itemHome}"));
       }
       }.run();
       }
      
       @Test
       public void testPageParameter() throws Exception {
       new NonFacesRequest("/item.xhtml") {
      
       @Override
       protected void beforeRequest() {
       setParameter("id", "1");
       }
      
       @Override
       protected void renderResponse() throws Exception {
       checkItemRetrieval(getValue("#{itemHome}"));
       }
       }.run();
       }
      
       private void checkItemRetrieval(Object object) {
       ItemHome itemHome = (ItemHome) object;
       assert itemHome.getInstance().getId() != null;
       }
      }
      


      ItemHome.java
      
      @Name("itemHome")
      public class ItemHome extends EntityHome<Item>
      {
      
       @RequestParameter
       Long itemId;
      
       @Override
       public Object getId()
       {
       if (itemId==null)
       {
       return super.getId();
       }
       else
       {
       return itemId;
       }
       }
      }
      


      pages.xml
      <page view-id="/item.xhtml">
       <param name="id"
       value="#{itemHome.id}"
       converterId="javax.faces.Long"/>
      </page>
      


      The first test passes, but the second one fails. Am I doing this correctly?
      If so, I'll open a jira issue.
      I'm using cvs HEAD.
      Thanks.