1 7 package com.inversoft.verge.mvc.model.actionflow.test; 8 9 10 import com.inversoft.junit.WebTestCase; 11 import com.inversoft.verge.mvc.model.DefaultModelHandler; 12 import com.inversoft.verge.mvc.model.actionflow.ActionFlowModelMetaData; 13 14 15 25 public class ActionFlowModelMetaDataTest extends WebTestCase { 26 27 30 public ActionFlowModelMetaDataTest(String name) { 31 super(name); 32 setLocal(true); 33 } 34 35 36 39 public void testAll() { 40 try { 41 ActionFlowModelMetaData md = new ActionFlowModelMetaData("test.string1"); 42 assertEquals("Should have an id of test", md.getID(), "test"); 43 assertEquals("Should have an property of string1", md.getProperty(), 44 "string1"); 45 assertEquals("Should have an definition of test.string1", "test.string1", 46 md.getDefinition()); 47 assertNotNull("Should have model handler", md.getModelHandler()); 48 assertTrue("Should have web model handler", 49 md.getModelHandler() instanceof DefaultModelHandler); 50 } catch (Exception e) { 51 fail(e.toString()); 52 } 53 54 try { 55 ActionFlowModelMetaData md = new ActionFlowModelMetaData("test", 56 "string1"); 57 assertEquals("Should have an id of test", md.getID(), "test"); 58 assertEquals("Should have an property of string1", md.getProperty(), 59 "string1"); 60 assertEquals("Should be the same definition", "test.string1", md.getDefinition()); 61 assertNotNull("Should have model handler", md.getModelHandler()); 62 assertTrue("Should have web model handler", 63 md.getModelHandler() instanceof DefaultModelHandler); 64 } catch (Exception e) { 65 fail(e.toString()); 66 } 67 68 try { 70 ActionFlowModelMetaData md = new ActionFlowModelMetaData("item", null); 71 assertEquals("Should be item", "item", md.getID()); 72 assertNull("Should be null", md.getProperty()); 73 md.setProperty("string1"); 74 assertEquals("Should have an property of string1", md.getProperty(), 75 "string1"); 76 assertEquals("item.string1", md.getDefinition()); 77 md.setProperty("string2"); 78 assertEquals("item.string2", md.getDefinition()); 79 md.setProperty("foo"); 80 assertEquals("item.foo", md.getDefinition()); 81 } catch (Exception e) { 82 fail(e.toString()); 83 } 84 } 85 } 86 | Popular Tags |