1 package org.melati.template.test;
2
3 import org.melati.MelatiConfig;
4 import org.melati.template.TemplateContext;
5 import org.melati.template.TemplateEngineException;
6 import org.melati.template.velocity.VelocityTemplateEngine;
7 import org.melati.util.MelatiBugMelatiException;
8 import org.melati.util.MelatiException;
9
10
11
12
13
14
15
16
17
18 public class HTMLMarkupLanguageVelocityTest extends HTMLMarkupLanguageSpec {
19
20
21
22
23 public HTMLMarkupLanguageVelocityTest() {
24 super();
25 }
26
27
28
29
30
31 protected void setUp() throws Exception {
32 super.setUp();
33 TemplateContext templateContext =
34 templateEngine.getTemplateContext();
35 m.setTemplateContext(templateContext);
36 }
37
38 protected void melatiConfig() throws MelatiException {
39 mc = new MelatiConfig();
40 mc.setTemplateEngine(new VelocityTemplateEngine());
41 }
42
43
44
45
46 public void testSyntaxErrorInWMTemplet() throws Exception {
47 Object templated = new TemplatedWithWMSyntaxError();
48 try {
49 ml.rendered(templated);
50 fail("Should have bombed");
51 } catch (MelatiBugMelatiException e) {
52 assertTrue(e.getCause().getMessage().startsWith("Encountered"));
53 e = null;
54 } catch (TemplateEngineException e) {
55
56 assertTrue(e.getCause().getMessage().startsWith("Encountered"));
57 e = null;
58 }
59 }
60
61 }