[jboss-cvs] jboss-seam/src/test/unit/org/jboss/seam/test/unit ...

Dan Allen dan.j.allen at gmail.com
Tue Jan 8 13:23:06 EST 2008


  User: dallen  
  Date: 08/01/08 13:23:06

  Modified:    src/test/unit/org/jboss/seam/test/unit   testng.xml
  Added:       src/test/unit/org/jboss/seam/test/unit   PageParamTest.java
  Log:
  test for  JBSEAM-2460
  
  Revision  Changes    Path
  1.9       +1 -0      jboss-seam/src/test/unit/org/jboss/seam/test/unit/testng.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: testng.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/test/unit/org/jboss/seam/test/unit/testng.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- testng.xml	28 Nov 2007 20:34:20 -0000	1.8
  +++ testng.xml	8 Jan 2008 18:23:06 -0000	1.9
  @@ -19,6 +19,7 @@
          <class name="org.jboss.seam.test.unit.DataModelTest"/>
          <class name="org.jboss.seam.test.unit.PageflowTest"/>
          <class name="org.jboss.seam.test.unit.PageActionsTest" />
  +       <class name="org.jboss.seam.test.unit.PageParamTest" />
          <class name="org.jboss.seam.test.unit.HomeTest" />
          <class name="org.jboss.seam.test.unit.NamespaceTest" />
          <class name="org.jboss.seam.test.unit.ImportTest"/>
  
  
  
  1.1      date: 2008/01/08 18:23:06;  author: dallen;  state: Exp;jboss-seam/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
  
  Index: PageParamTest.java
  ===================================================================
  package org.jboss.seam.test.unit;
  
  import javax.faces.component.UIComponent;
  import javax.faces.context.FacesContext;
  import javax.faces.convert.IntegerConverter;
  import javax.faces.validator.Validator;
  import javax.faces.validator.ValidatorException;
  
  import org.jboss.seam.mock.MockApplication;
  import org.jboss.seam.mock.MockExternalContext;
  import org.jboss.seam.mock.MockFacesContext;
  import org.jboss.seam.navigation.Param;
  import org.testng.annotations.Test;
  
  public class PageParamTest
  {
     @Test
     public void testGetConverterById()
     {
        String converterId = "javax.faces.Integer";
        String converterClass = "javax.faces.convert.IntegerConverter";
        MockFacesContext facesContext = new MockFacesContext(new MockExternalContext(), new MockApplication());
        facesContext.setCurrent();
        Param param = new Param("param");
        param.setConverterId(converterId);
        assert param.getConverter() instanceof IntegerConverter : "expecting: " + converterClass + "; got: " + param.getConverter();
     }
     
     @Test
     public void testGetValidatorById() throws ClassNotFoundException
     {
        String validatorId = "TestValidator";
        String validatorClass= "org.jboss.seam.test.unit.PageParamTest$TestValidator";
        MockFacesContext facesContext = new MockFacesContext(new MockExternalContext(), new MockApplication());
        facesContext.setCurrent();
        facesContext.getApplication().addValidator(validatorId, validatorClass);
        Param param = new Param("param");
        param.setValidatorId(validatorId);
        assert param.getValidator() instanceof TestValidator : "expecting: " + validatorClass + "; got: " + param.getValidator();
     }
     
     public static class TestValidator implements Validator
     {
        public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
        {
        }
        
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list