1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap;
18
19 import java.util.Iterator;
20 import javax.xml.namespace.QName;
21 import javax.xml.transform.Transformer;
22 import javax.xml.transform.TransformerFactory;
23
24 import org.custommonkey.xmlunit.XMLTestCase;
25
26 public abstract class AbstractSoapElementTestCase extends XMLTestCase {
27
28 private SoapElement soapElement;
29
30 protected Transformer transformer;
31
32 protected final void setUp() throws Exception {
33 TransformerFactory transformerFactory = TransformerFactory.newInstance();
34 transformer = transformerFactory.newTransformer();
35 soapElement = createSoapElement();
36 }
37
38 protected abstract SoapElement createSoapElement() throws Exception;
39
40 public void testAttributes() throws Exception {
41 QName name = new QName("http://springframework.org/spring-ws", "attribute");
42 String value = "value";
43 soapElement.addAttribute(name, value);
44 assertEquals("Invalid attribute value", value, soapElement.getAttributeValue(name));
45 Iterator allAttributes = soapElement.getAllAttibutes();
46 assertTrue("Iterator is empty", allAttributes.hasNext());
47
48 }
49
50
51 }