1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.view.facelets.tag.ui;
21
22 import java.io.StringWriter;
23
24 import javax.faces.component.UIViewRoot;
25
26 import org.apache.myfaces.test.mock.MockResponseWriter;
27 import org.apache.myfaces.view.facelets.FaceletTestCase;
28 import org.junit.Assert;
29 import org.junit.Test;
30
31 public class DefineIncludeTestCase extends FaceletTestCase {
32
33 @Override
34 protected void setupComponents() throws Exception
35 {
36 application.addComponent(UIViewRoot.COMPONENT_TYPE,
37 UIViewRoot.class.getName());
38 }
39
40 @Override
41 protected void setupConvertersAndValidators() throws Exception
42 {
43 }
44
45 @Override
46 protected void setupRenderers() throws Exception
47 {
48 }
49
50 @Test
51 public void testDefineInclude() throws Exception {
52 UIViewRoot root = facesContext.getViewRoot();
53 vdl.buildView(facesContext, root, "defineInclude.xml");
54
55 StringWriter sw = new StringWriter();
56 MockResponseWriter mrw = new MockResponseWriter(sw);
57 facesContext.setResponseWriter(mrw);
58 root.encodeAll(facesContext);
59 sw.flush();
60
61 String response = sw.toString();
62
63
64 Assert.assertEquals("Hello World!Hello World!", response);
65
66 Assert.assertFalse(response.contains("Not Found"));
67
68
69
70
71 }
72
73 }