1
2
3
4 package org.melati.template.test;
5
6 import java.util.Enumeration;
7
8 import org.melati.Melati;
9 import org.melati.MelatiConfig;
10 import org.melati.poem.test.PoemTestCase;
11 import org.melati.template.TemplateEngine;
12 import org.melati.util.MelatiStringWriter;
13
14
15
16
17
18
19 public abstract class TemplateEngineSpec extends PoemTestCase {
20
21 protected TemplateEngine templateEngine = null;
22
23
24
25
26 public TemplateEngineSpec(String name) {
27 super(name);
28 }
29
30
31
32
33
34 protected void setUp() throws Exception {
35 super.setUp();
36 setTemplateEngine();
37 }
38
39
40
41
42
43 protected void tearDown() throws Exception {
44 super.tearDown();
45 }
46
47
48 abstract protected void setTemplateEngine();
49
50
51
52 public void testInit() throws Exception {
53 MelatiConfig mc = new MelatiConfig();
54 templateEngine.init(mc);
55
56 }
57
58
59
60
61 public void testGetTemplateContext() throws Exception {
62 MelatiConfig mc = new MelatiConfig();
63 templateEngine.init(mc);
64 Melati melati = new Melati(mc,new MelatiStringWriter());
65 templateEngine.getTemplateContext(melati);
66 }
67
68
69
70
71 public abstract void testGetName();
72
73
74
75
76 public abstract void testTemplateExtension();
77
78
79
80
81 public void testGetRoots() {
82
83 }
84
85
86
87
88 public void testAddRoot() {
89 Enumeration en = templateEngine.getRoots();
90 int counter = 0;
91 while (en.hasMoreElements()) {
92 en.nextElement();
93 counter++;
94 }
95 assertEquals(1, counter);
96 templateEngine.addRoot("root");
97 en = templateEngine.getRoots();
98 counter = 0;
99 while (en.hasMoreElements()) {
100 en.nextElement();
101 counter++;
102 }
103 assertEquals(2, counter);
104 }
105
106
107
108
109 public void testTemplate() {
110
111 }
112
113
114
115
116 public void testGetTemplateName() {
117
118 }
119
120
121
122
123
124 public void testExpandTemplateMelatiWriterStringTemplateContext() throws Exception {
125
126 }
127
128
129
130
131
132 public void testExpandTemplateMelatiWriterTemplateTemplateContext() throws Exception {
133
134 }
135
136
137
138
139
140 public void testExpandedTemplate() throws Exception {
141
142 }
143
144
145
146
147 public void testGetStringWriter() {
148
149 }
150
151
152
153
154 public void testGetEngine() {
155
156 }
157
158 }