1 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 name) 27 { 28 super(name); 29 } 30 31 public static TestSuite suite() throws Exception 32 { 33 return new TestSuite(TestBreakTag.class); 34 } 35 36 public void testSimpleBreakTag() throws Exception 37 { 38 setUpScript("testBreakTag.jelly"); 39 Script script = getJelly().compileScript(); 40 41 script.run(getJellyContext(), getXMLOutput()); 42 43 String simpleResult = (String ) getJellyContext().getVariable("simpleResult"); 44 45 assertEquals("simpleResult", "12345", simpleResult); 46 } 47 48 public void testConditionalBreakTag() throws Exception 49 { 50 setUpScript("testBreakTag.jelly"); 51 Script script = getJelly().compileScript(); 52 53 script.run(getJellyContext(), getXMLOutput()); 54 55 String simpleResult = (String ) getJellyContext().getVariable("conditionalResult"); 56 57 assertEquals("conditionalResult", "12345", simpleResult); 58 } 59 60 public void testVarBreakTag() throws Exception 61 { 62 setUpScript("testBreakTag.jelly"); 63 Script script = getJelly().compileScript(); 64 65 script.run(getJellyContext(), getXMLOutput()); 66 67 String varBroken = (String ) getJellyContext().getVariable("varBroken"); 68 69 assertEquals("varBroken", "true", varBroken); 70 } 71 72 public void testVarNoBreakTag() throws Exception 73 { 74 setUpScript("testBreakTag.jelly"); 75 Script script = getJelly().compileScript(); 76 77 script.run(getJellyContext(), getXMLOutput()); 78 79 String varNotBroken = (String ) getJellyContext().getVariable("varNotBroken"); 80 81 assertEquals("varNotBroken", "false", varNotBroken); 82 } 83 84 85 } 86 | Popular Tags |