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.JellyTagException; 22 import org.apache.commons.jelly.test.BaseJellyTest; 23 24 27 28 public class TestGetStaticTag extends BaseJellyTest { 29 30 public TestGetStaticTag(String name) { 31 super(name); 32 } 33 34 35 public static TestSuite suite() throws Exception { 36 return new TestSuite(TestGetStaticTag.class); 37 } 38 39 40 44 45 public void testGetIntegerMaxValue() throws Exception { 46 47 setUpScript( "testGetStaticTag.jelly" ); 48 49 Script script = getJelly().compileScript(); 50 51 getJellyContext().setVariable( "test.Integer.MAX_VALUE", 52 Boolean.TRUE ); 53 54 script.run( getJellyContext(), getXMLOutput() ); 55 56 assertEquals( new Integer (java.lang.Integer.MAX_VALUE), 57 getJellyContext().getVariable("value" ) ); 58 } 59 60 61 62 65 66 public void testInvalidGet() throws Exception { 67 68 setUpScript( "testGetStaticTag.jelly" ); 69 70 Script script = getJelly().compileScript(); 71 72 getJellyContext().setVariable( "test.InvalidGet", Boolean.TRUE ); 73 74 try { 75 script.run( getJellyContext(), getXMLOutput() ); 76 } catch(JellyTagException jte) { 77 return; 78 } 79 80 fail("JellyTagException not thrown."); 81 } 82 83 } 84 85 92 | Popular Tags |