1 package org.melati.template.test;
2
3 import org.melati.MelatiConfig;
4 import org.melati.template.TemplateEngineException;
5 import org.melati.template.velocity.VelocityTemplateEngine;
6 import org.melati.util.MelatiBugMelatiException;
7 import org.melati.util.MelatiException;
8
9
10 /**
11 * Run all the tests against velocity.
12 *
13 * @author timp
14 * @since 21-May-2006
15 *
16 */
17 public class WMLMarkupLanguageVelocityTest extends WMLMarkupLanguageSpec {
18
19 /**
20 * Constructor.
21 */
22 public WMLMarkupLanguageVelocityTest() {
23 super();
24 }
25
26 protected void melatiConfig() throws MelatiException {
27 mc = new MelatiConfig();
28 mc.setTemplateEngine(new VelocityTemplateEngine());
29 }
30
31 /**
32 * Test that a syntax error in a WM templet is handled by Velocity.
33 */
34 public void testSyntaxErrorInWMTemplet() throws Exception {
35 Object templated = new TemplatedWithWMSyntaxError();
36 try {
37 ml.rendered(templated);
38 fail("Should have bombed");
39 } catch (MelatiBugMelatiException e) {
40 assertTrue(e.getCause().getMessage().startsWith("Encountered"));
41 e = null;
42 } catch (TemplateEngineException e) {
43
44 assertTrue(e.getCause().getMessage().startsWith("Encountered"));
45 e = null;
46 }
47 }
48
49 }