1 16 17 package org.apache.commons.betwixt; 18 19 import java.io.StringReader ; 20 21 import junit.framework.TestCase; 22 23 import org.apache.commons.betwixt.io.BeanReader; 24 25 30 public class TestConversion extends TestCase{ 31 32 public TestConversion(String name) { 33 super(name); 34 } 35 36 40 public void testNullTimestampConversion() throws Exception { 41 String xml = "<?xml version='1.0'?>" + 42 "<EventBean>" + 43 "<type>WARNING</type>" + 44 "<start>2004-02-10 00:00:00.0</start>" + 45 "<end/>" + 46 "</EventBean>"; 47 48 StringReader in = new StringReader (xml); 49 BeanReader reader = new BeanReader(); 50 reader.registerBeanClass(EventBean.class); 51 EventBean bean = (EventBean) reader.parse(in); 52 53 assertNotNull("Parsing should work", bean); 54 assertEquals("Type property", "WARNING", bean.getType()); 55 assertEquals("Start property", "2004-02-10 00:00:00.0", bean.getStart().toString()); 56 assertNull("End property", bean.getEnd()); 57 } 58 59 } 60 | Popular Tags |