Debian Codegraph @

test/wsdl/union/UnionServiceTestCase.java

raw
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 // make sure WSDL2Java generated the right stuff
19
20 // we don't really need to test sending a request
21 // and getting a response, since many other tests comprehend that
22 // all we need to do is make sure WSDL2Java generated the right beans
23 // so, basically, if this compiles, we are good to go
24 // but running it won't hurt anything
25
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 // make sure WSDL2Java generated the right stuff
45
46 // we don't really need to test sending a request
47 // and getting a response, since many other tests comprehend that
48 // all we need to do is make sure WSDL2Java generated the right beans
49 // so, basically, if this compiles, we are good to go
50 // but running it won't hurt anything
51
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 }