1 7 package com.inversoft.verge.mvc.controller.actionflow.config.test; 8 9 10 import org.jdom.Element; 11 12 import com.inversoft.config.ConfigurationException; 13 import com.inversoft.junit.WebTestCase; 14 import com.inversoft.verge.mvc.controller.actionflow.config.BaseNamespaceBuilder; 15 import com.inversoft.verge.mvc.controller.actionflow.config.Namespace; 16 import com.inversoft.verge.mvc.controller.actionflow.config.NamespaceBuilder; 17 18 19 28 public class NamespaceBuilderTest extends WebTestCase { 29 30 34 public NamespaceBuilderTest(String name) { 35 super(name); 36 setLocal(true); 37 } 38 39 42 public void testBaseNamespaceFactory() { 43 44 NamespaceBuilder factory = new BaseNamespaceBuilder(); 46 47 Element element = new Element("namespace"); 48 element.setAttribute("name", "foo"); 49 50 try { 51 Namespace namespace = factory.build(element); 52 assertTrue("Should have name of foo", namespace.getName().equals("foo")); 53 } catch (ConfigurationException be) { 54 fail(be.toString()); 55 } 56 57 element = new Element("namespace"); 59 60 try { 61 factory.build(element); 62 fail("Should have failed because namespace has no name"); 63 } catch (ConfigurationException be) { 64 assertTrue("There should be errors", !be.getErrors().isEmpty()); 65 System.out.println(be.toString()); 66 } 67 } 68 } | Popular Tags |