1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.core;
17
18 import junit.framework.TestSuite;
19
20 import org.apache.commons.jelly.Script;
21
22 public class TestBreakTag extends BaseJellyTest
23 {
24
25 public TestBreakTag(String name)
26 {
27 super(name);
28 }
29
30 public static TestSuite suite() throws Exception
31 {
32 return new TestSuite(TestBreakTag.class);
33 }
34
35 public void testSimpleBreakTag() throws Exception
36 {
37 setUpScript("testBreakTag.jelly");
38 Script script = getJelly().compileScript();
39
40 script.run(getJellyContext(), getXMLOutput());
41
42 String simpleResult = (String) getJellyContext().getVariable("simpleResult");
43
44 assertEquals("simpleResult", "12345", simpleResult);
45 }
46
47 public void testConditionalBreakTag() throws Exception
48 {
49 setUpScript("testBreakTag.jelly");
50 Script script = getJelly().compileScript();
51
52 script.run(getJellyContext(), getXMLOutput());
53
54 String simpleResult = (String) getJellyContext().getVariable("conditionalResult");
55
56 assertEquals("conditionalResult", "12345", simpleResult);
57 }
58
59 public void testVarBreakTag() throws Exception
60 {
61 setUpScript("testBreakTag.jelly");
62 Script script = getJelly().compileScript();
63
64 script.run(getJellyContext(), getXMLOutput());
65
66 String varBroken = (String) getJellyContext().getVariable("varBroken");
67
68 assertEquals("varBroken", "true", varBroken);
69 }
70
71 public void testVarNoBreakTag() throws Exception
72 {
73 setUpScript("testBreakTag.jelly");
74 Script script = getJelly().compileScript();
75
76 script.run(getJellyContext(), getXMLOutput());
77
78 String varNotBroken = (String) getJellyContext().getVariable("varNotBroken");
79
80 assertEquals("varNotBroken", "false", varNotBroken);
81 }
82
83
84 }