1 16 17 package org.apache.commons.jelly.test.xml; 18 19 import java.net.URL ; 20 21 import junit.framework.TestCase; 22 import junit.framework.TestSuite; 23 24 import org.apache.commons.jelly.Jelly; 25 import org.apache.commons.jelly.JellyContext; 26 import org.apache.commons.jelly.JellyException; 27 import org.apache.commons.jelly.Script; 28 import org.apache.commons.jelly.XMLOutput; 29 30 37 public class TestNonexistentTags extends TestCase { 38 Jelly jelly = null; 39 JellyContext context = null; 40 XMLOutput xmlOutput = null; 41 42 public TestNonexistentTags(String name) { 43 super(name); 44 } 45 46 public static TestSuite suite() throws Exception { 47 return new TestSuite(TestNonexistentTags.class); 48 } 49 50 public void setUp(String scriptName) throws Exception { 51 context = new JellyContext(); 52 xmlOutput = XMLOutput.createDummyXMLOutput(); 53 54 jelly = new Jelly(); 55 56 String script = scriptName; 57 URL url = this.getClass().getResource(script); 58 if ( url == null ) { 59 throw new Exception ( 60 "Could not find Jelly script: " + script 61 + " in package of class: " + this.getClass().getName() 62 ); 63 } 64 jelly.setUrl(url); 65 } 66 67 70 public void testNonexistentTags() throws Exception { 71 setUp("nonexistentTags1.jelly"); 72 try { 73 Script script = jelly.compileScript(); 74 fail("Scripts should throw JellyException when it declares a nonexistent tag."); 75 } catch (JellyException e) { 76 } 77 } 78 79 } 80 | Popular Tags |