Debian Codegraph @

test/encoding/TestDeser2000.java

raw
1 package test.encoding;
2
3 import org.apache.axis.Constants;
4
5 import java.util.ArrayList;
6 import java.util.HashMap;
7
8 /**
9 * Test deserialization of SOAP responses
10 */
11 public class TestDeser2000 extends TestDeser {
12
13 public TestDeser2000(String name) {
14 super(name, Constants.URI_2000_SCHEMA_XSI,
15 Constants.URI_2000_SCHEMA_XSD);
16 }
17
18 public void testMapWithNulls() throws Exception {
19 HashMap m = new HashMap();
20 m.put(null, new Boolean("false"));
21 m.put("hi", null);
22 deserialize("<result xsi:type=\"xmlsoap:Map\" " +
23 "xmlns:xmlsoap=\"http://xml.apache.org/xml-soap\"> " +
24 "<item>" +
25 "<key xsi:null=\"true\"/>" +
26 "<value xsi:type=\"xsd:boolean\">false</value>" +
27 "</item><item>" +
28 "<key xsi:type=\"xsd:string\">hi</key>" +
29 "<value xsi:null=\"true\"/>" +
30 "</item>" +
31 "</result>",
32 m);
33 }
34
35 public void testArrayWithNullInt() throws Exception {
36 ArrayList list = new ArrayList(4);
37 list.add(new Integer(1));
38 list.add(null);
39 list.add(new Integer(3));
40 deserialize("<result xsi:type=\"soapenc:Array\" " +
41 "soapenc:arrayType=\"xsd:int[3]\"> " +
42 "<item xsi:type=\"xsd:int\">1</item>" +
43 "<item xsi:null=\"true\"/>" +
44 "<item xsi:type=\"xsd:int\">3</item>" +
45 "</result>",
46 list, true);
47 }
48
49 public void testArrayWithNullString() throws Exception {
50 ArrayList list = new ArrayList(4);
51 list.add("abc");
52 list.add(null);
53 list.add("def");
54 deserialize("<result xsi:type=\"soapenc:Array\" " +
55 "soapenc:arrayType=\"xsd:string[3]\"> " +
56 "<item xsi:type=\"xsd:string\">abc</item>" +
57 "<item xsi:null=\"true\"/>" +
58 "<item xsi:type=\"xsd:string\">def</item>" +
59 "</result>",
60 list, true);
61 }
62
63 public void testNullSOAPBoolean() throws Exception {
64 deserialize("<result xsi:type=\"soapenc:boolean\" xsi:null=\"true\" />",
65 null);
66 }
67 }