1 package test.wsdl.union; 2 3 import java.util.Date; 4 import java.util.Calendar; 5 6 import org.apache.axis.types.URI; 7 import org.apache.axis.encoding.ser.CalendarSerializer; 8 9 import junit.framework.TestCase; 10 11 public class UnionServiceTestCase extends TestCase { 12 13 public UnionServiceTestCase(String name) { 14 super(name); 15 } 16 17 public void testBasicUnion1() throws Exception { 18 20 26 FooOpenEnum enum = null; 27 28 String testStrURI = "http://foobar/A"; 29 enum = new FooOpenEnum(testStrURI); 30 assertEquals(testStrURI, enum.toString()); 31 32 URI testURI = new URI(testStrURI); 33 enum = new FooOpenEnum(testURI); 34 assertEquals(testStrURI, enum.toString()); 35 assertEquals(testURI, enum.getAnyURIValue()); 36 37 enum = new FooOpenEnum(FooEnum.value1); 38 assertEquals(FooEnum.value1.toString(), enum.toString()); 39 assertEquals(FooEnum.value1, enum.getFooEnumValue()); 40 assertEquals(FooEnum._value1, enum.getAnyURIValue()); 41 } 42 43 public void testBasicUnion2() throws Exception { 44 46 52 DateOrDateTimeType type = null; 53 54 type = new DateOrDateTimeType(5); 55 assertEquals("5", type.toString()); 56 57 type = new DateOrDateTimeType(false); 58 assertEquals("false", type.toString()); 59 60 Date date = new Date(); 61 type = new DateOrDateTimeType(date); 62 assertEquals(date.toString(), type.toString()); 63 64 Calendar cal = Calendar.getInstance(); 65 type = new DateOrDateTimeType(cal); 66 67 CalendarSerializer cs = new CalendarSerializer(); 68 assertEquals(cs.getValueAsString(cal, null), type.toString()); 69 } 70 71 } 72 | Popular Tags |