1 package com.sun.facelets.tag.jsf.html; 2 3 import javax.faces.component.UISelectOne; 4 import javax.faces.component.UIViewRoot; 5 import javax.faces.context.FacesContext; 6 7 import com.sun.facelets.Facelet; 8 import com.sun.facelets.FaceletFactory; 9 import com.sun.facelets.FaceletTestCase; 10 11 public class SelectTestCase extends FaceletTestCase { 12 13 public void testSelectOne() throws Exception { 14 FaceletFactory ff = FaceletFactory.getInstance(); 15 Facelet f = ff.getFacelet("selectOne.xml"); 16 this.servletRequest.getSession().setAttribute("test", new TestBean()); 17 this.servletRequest.setParameter("testForm:alignment", "10"); 18 FacesContext faces = FacesContext.getCurrentInstance(); 19 UIViewRoot root = new UIViewRoot(); 20 f.apply(faces, root); 21 UISelectOne one = (UISelectOne) root.findComponent("testForm:alignment"); 22 root.processDecodes(faces); 23 root.processValidators(faces); 24 System.out.println(faces.getMessages().hasNext()); 25 } 26 27 } 28 | Popular Tags |