KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > state > config > types > TypesTest


1 package org.sapia.soto.state.config.types;
2
3 import java.io.File JavaDoc;
4 import java.text.SimpleDateFormat JavaDoc;
5
6 import org.sapia.soto.SotoContainer;
7 import org.sapia.soto.examples.TypeService;
8
9 import junit.framework.TestCase;
10
11 /**
12  * @author Yanick Duchesne
13  *
14  * <dl>
15  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
16  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
17  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
18  * </dl>
19  */

20 public class TypesTest extends TestCase{
21     
22     public TypesTest(String JavaDoc name){
23         super(name);
24     }
25     
26     public void testTypes() throws Exception JavaDoc{
27         SotoContainer container = new SotoContainer();
28         try{
29             container.load(new File JavaDoc("etc/test/types.xml"));
30         }catch(Exception JavaDoc 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 JavaDoc sdf = new SimpleDateFormat JavaDoc("yyyy/MM/DD");
43         super.assertEquals(sdf.parse("2000/12/25"), ts.getSomeDate());
44     }
45
46 }
47
Popular Tags