1 package org.sapia.soto.state.config.types; 2 3 import java.io.File ; 4 import java.text.SimpleDateFormat ; 5 6 import org.sapia.soto.SotoContainer; 7 import org.sapia.soto.examples.TypeService; 8 9 import junit.framework.TestCase; 10 11 20 public class TypesTest extends TestCase{ 21 22 public TypesTest(String name){ 23 super(name); 24 } 25 26 public void testTypes() throws Exception { 27 SotoContainer container = new SotoContainer(); 28 try{ 29 container.load(new File ("etc/test/types.xml")); 30 }catch(Exception e){ 31 e.printStackTrace(); 32 throw e; 33 } 34 35 TypeService ts = (TypeService)container.lookup("typeService"); 36 super.assertTrue(ts.isSomeBoolean()); 37 super.assertEquals(1, ts.getSomeShort()); 38 super.assertEquals(2, ts.getSomeInt()); 39 super.assertEquals(3, ts.getSomeLong()); 40 super.assertTrue(4 == ts.getSomeFloat()); 41 super.assertTrue(5 == ts.getSomeDouble()); 42 SimpleDateFormat sdf = new SimpleDateFormat ("yyyy/MM/DD"); 43 super.assertEquals(sdf.parse("2000/12/25"), ts.getSomeDate()); 44 } 45 46 } 47 | Popular Tags |