Package com.sun.facelets

Source Code of com.sun.facelets.TagTestCase

package com.sun.facelets;

import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

import com.sun.facelets.mock.MockResponseWriter;
import com.sun.facelets.util.FastWriter;

public class TagTestCase extends FaceletTestCase {

    public void testTagBody() throws Exception {
        FaceletFactory ff = FaceletFactory.getInstance();
        FacesContext faces = FacesContext.getCurrentInstance();
       
        Facelet f = ff.getFacelet("userTag.xhtml");
       
        this.servletRequest.setAttribute("name", "Mr. Hookom");
       
        UIViewRoot root = faces.getViewRoot();
        f.apply(faces, root);
       
        FastWriter fw = new FastWriter();
        MockResponseWriter mrw = new MockResponseWriter(fw);
        faces.setResponseWriter(mrw);
        root.encodeAll(faces);
        System.out.println(fw);
    }

    public void testConditionalInsert() throws Exception {
        FaceletFactory ff = FaceletFactory.getInstance();
        FacesContext faces = FacesContext.getCurrentInstance();
       
        Facelet f = ff.getFacelet("userTagConditional.xhtml");

        UIViewRoot root = faces.getViewRoot();
        f.apply(faces, root);
       
        FastWriter fw = new FastWriter();
        MockResponseWriter mrw = new MockResponseWriter(fw);
        faces.setResponseWriter(mrw);
        root.encodeAll(faces);
        System.out.println(fw);
    }

}
TOP

Related Classes of com.sun.facelets.TagTestCase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.