KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > TagTestCase


1 package com.sun.facelets;
2
3 import javax.faces.component.UIViewRoot;
4 import javax.faces.context.FacesContext;
5
6 import com.sun.facelets.mock.MockResponseWriter;
7 import com.sun.facelets.util.FastWriter;
8
9 public class TagTestCase extends FaceletTestCase {
10
11     public void testTagBody() throws Exception JavaDoc {
12         FaceletFactory ff = FaceletFactory.getInstance();
13         FacesContext faces = FacesContext.getCurrentInstance();
14         
15         Facelet f = ff.getFacelet("userTag.xhtml");
16         
17         this.servletRequest.setAttribute("name", "Mr. Hookom");
18         
19         UIViewRoot root = faces.getViewRoot();
20         f.apply(faces, root);
21         
22         FastWriter fw = new FastWriter();
23         MockResponseWriter mrw = new MockResponseWriter(fw);
24         faces.setResponseWriter(mrw);
25         root.encodeAll(faces);
26         System.out.println(fw);
27     }
28
29     public void testConditionalInsert() throws Exception JavaDoc {
30         FaceletFactory ff = FaceletFactory.getInstance();
31         FacesContext faces = FacesContext.getCurrentInstance();
32         
33         Facelet f = ff.getFacelet("userTagConditional.xhtml");
34
35         UIViewRoot root = faces.getViewRoot();
36         f.apply(faces, root);
37         
38         FastWriter fw = new FastWriter();
39         MockResponseWriter mrw = new MockResponseWriter(fw);
40         faces.setResponseWriter(mrw);
41         root.encodeAll(faces);
42         System.out.println(fw);
43     }
44
45 }
46
Popular Tags