KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > jelly > core > TestBreakTag


1 /*
2  * Copyright 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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