1 7 package com.inversoft.verge.mvc.model.repository.test; 8 9 10 import com.inversoft.junit.WebTestCase; 11 import com.inversoft.verge.mvc.model.repository.RepositoryMetaData; 12 import com.inversoft.verge.mvc.model.repository.RepositoryModelHandler; 13 14 15 25 public class RepositoryMetaDataTest extends WebTestCase { 26 27 30 public RepositoryMetaDataTest(String name) { 31 super(name); 32 setLocal(true); 33 } 34 35 36 39 public void testAll() { 40 try { 41 RepositoryMetaData md = new RepositoryMetaData("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("definition != test.string1", md.getDefinition(), 46 "test.string1"); 47 assertNotNull("Should have model handler", md.getModelHandler()); 48 assertTrue("Should be repository model handler", 49 md.getModelHandler() instanceof RepositoryModelHandler); 50 } catch (Exception e) { 51 fail(e.toString()); 52 } 53 54 try { 55 RepositoryMetaData md = new RepositoryMetaData("test", "string1"); 56 assertEquals("Should have an id of test", md.getID(), "test"); 57 assertEquals("Should have an property of string1", md.getProperty(), 58 "string1"); 59 assertEquals("definition != test.string1", md.getDefinition(), 60 "test.string1"); 61 assertNotNull("Should have model handler", md.getModelHandler()); 62 assertTrue("Should be repository model handler", 63 md.getModelHandler() instanceof RepositoryModelHandler); 64 } catch (Exception e) { 65 fail(e.toString()); 66 } 67 68 try { 69 RepositoryMetaData md = new RepositoryMetaData("item", null); 70 assertEquals("Should be item", "item", md.getID()); 71 assertNull("Should be null", md.getProperty()); 72 md.setID("test"); 73 assertEquals("Should have an id of test", md.getID(), "test"); 74 md.setProperty("string1"); 75 assertEquals("Should have an property of string1", md.getProperty(), 76 "string1"); 77 assertNotNull("Should have model handler", md.getModelHandler()); 78 assertTrue("Should be repository model handler", 79 md.getModelHandler() instanceof RepositoryModelHandler); 80 } catch (Exception e) { 81 fail(e.toString()); 82 } 83 84 try { 86 RepositoryMetaData md = new RepositoryMetaData("item", null); 87 assertEquals("Should be item", "item", md.getID()); 88 assertNull("Should be null", md.getProperty()); 89 md.setProperty("string1"); 90 assertEquals("Should have an property of string1", md.getProperty(), 91 "string1"); 92 assertEquals("item.string1", md.getDefinition()); 93 md.setProperty("string2"); 94 assertEquals("item.string2", md.getDefinition()); 95 md.setProperty("foo"); 96 assertEquals("item.foo", md.getDefinition()); 97 } catch (Exception e) { 98 fail(e.toString()); 99 } 100 } 101 } 102 | Popular Tags |