1 package org.sapia.regis.forms; 2 3 import org.sapia.regis.impl.NodeImpl; 4 import org.sapia.regis.type.BuiltinTypes; 5 6 import junit.framework.TestCase; 7 8 public class FormInstanceTest extends TestCase { 9 10 FormInstance f; 11 NodeImpl n; 12 13 public FormInstanceTest(String arg0) { 14 super(arg0); 15 } 16 17 protected void setUp() throws Exception { 18 Form form = new Form("test"); 19 form.createField(BuiltinTypes.INT_TYPE, "field1"); 20 form.createField(BuiltinTypes.BOOLEAN_TYPE, "field2"); 21 n = new NodeImpl(); 22 f = form.getInstance(n); 23 } 24 25 public void testSetProperty(){ 26 f.setProperty("field1", "100"); 27 f.setProperty("field2", "true"); 28 f.assign(); 29 assertTrue(n.getProperty("field1").asInt() == 100); 30 assertTrue(n.getProperty("field2").asBoolean()); 31 } 32 33 } 34 | Popular Tags |