1 7 package com.inversoft.verge.mvc.model.test; 8 9 10 import junit.framework.TestCase; 11 12 import com.inversoft.verge.mvc.model.ModelMVCInfo; 13 14 15 24 public class ModelMetaDataTest extends TestCase { 25 26 31 public ModelMetaDataTest(String name) { 32 super(name); 33 } 34 35 36 39 public void testAll() { 40 try { 41 String encoded = "testName|testSystem|testDefinition"; 42 ModelMVCInfo md = new ModelMVCInfo(encoded); 43 assertEquals("testName", md.getInputName()); 44 assertEquals("testSystem", md.getModelSystem()); 45 assertEquals("testDefinition", md.getModelDefinition()); 46 String newEncoded = md.encode(); 47 assertTrue("should be equal", newEncoded.equals(encoded)); 48 49 encoded = "testName|testSystem|testDefinition|param1=value1|param2=value2"; 50 String altEncoded = "testName|testSystem|testDefinition|param2=value2|param1=value1"; 51 md = new ModelMVCInfo(encoded); 52 assertEquals("testName", md.getInputName()); 53 assertEquals("testSystem", md.getModelSystem()); 54 assertEquals("testDefinition", md.getModelDefinition()); 55 assertTrue("should have param1", md.getExtraParams().get("param1") != null && 56 md.getExtraParams().get("param1").equals("value1")); 57 assertTrue("should have param2", md.getExtraParams().get("param2") != null && 58 md.getExtraParams().get("param2").equals("value2")); 59 newEncoded = md.encode(); 60 assertTrue("should be equal", newEncoded.equals(encoded) || 61 newEncoded.equals(altEncoded)); 62 } catch (Exception e) { 63 fail(e.toString()); 64 } 65 } 66 } | Popular Tags |