You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ve...@apache.org on 2009/01/12 00:31:35 UTC
svn commit: r733540 -
/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
Author: veithen
Date: Sun Jan 11 15:31:33 2009
New Revision: 733540
URL: http://svn.apache.org/viewvc?rev=733540&view=rev
Log:
Avoid using TestCase#fail in case of an exception. Instead just let JUnit intercept the exception.
Modified:
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java?rev=733540&r1=733539&r2=733540&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java Sun Jan 11 15:31:33 2009
@@ -46,43 +46,37 @@
*/
public class SOAPPartTest extends TestCase {
- public void testAddSource() {
- DOMSource domSource;
- try {
- /*
- FileReader testFile = new FileReader(new File(System.getProperty("basedir",".")+"/test-resources" + File.separator + "soap-part.xml"));
- StAXOMBuilder stAXOMBuilder =
- OMXMLBuilderFactory.createStAXOMBuilder(
- OMAbstractFactory.getSOAP11Factory(),
- XMLInputFactory.newInstance().createXMLStreamReader(
- testFile));
- */
-
- DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = builder.parse(new File(System.getProperty("basedir", ".") +
- "/test-resources" + File.separator + "soap-part.xml"));
- domSource = new DOMSource(document);
-
- SOAPMessage message = MessageFactory.newInstance().createMessage();
-
- // Get the SOAP part and set its content to domSource
- SOAPPart soapPart = message.getSOAPPart();
- soapPart.setContent(domSource);
- message.saveChanges();
-
- SOAPHeader header = message.getSOAPHeader();
- if (header != null) {
- Iterator iter1 = header.getChildElements();
- getContents(iter1, "");
- }
-
- SOAPBody body = message.getSOAPBody();
- Iterator iter2 = body.getChildElements();
- getContents(iter2, "");
-
- } catch (Exception e) {
- fail("Unexpected Exception : " + e);
+ public void testAddSource() throws Exception {
+ /*
+ FileReader testFile = new FileReader(new File(System.getProperty("basedir",".")+"/test-resources" + File.separator + "soap-part.xml"));
+ StAXOMBuilder stAXOMBuilder =
+ OMXMLBuilderFactory.createStAXOMBuilder(
+ OMAbstractFactory.getSOAP11Factory(),
+ XMLInputFactory.newInstance().createXMLStreamReader(
+ testFile));
+ */
+
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = builder.parse(new File(System.getProperty("basedir", ".") +
+ "/test-resources" + File.separator + "soap-part.xml"));
+ DOMSource domSource = new DOMSource(document);
+
+ SOAPMessage message = MessageFactory.newInstance().createMessage();
+
+ // Get the SOAP part and set its content to domSource
+ SOAPPart soapPart = message.getSOAPPart();
+ soapPart.setContent(domSource);
+ message.saveChanges();
+
+ SOAPHeader header = message.getSOAPHeader();
+ if (header != null) {
+ Iterator iter1 = header.getChildElements();
+ getContents(iter1, "");
}
+
+ SOAPBody body = message.getSOAPBody();
+ Iterator iter2 = body.getChildElements();
+ getContents(iter2, "");
}
public void getContents(Iterator iterator, String indent) {
@@ -161,28 +155,24 @@
}
- public void _testInputEncoding() {
- try {
- DOMSource domSource;
- DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = builder.parse(new File(System.getProperty("basedir", ".") +
- "/test-resources" + File.separator + "soap-part.xml"));
- domSource = new DOMSource(document);
-
- SOAPMessage message = MessageFactory.newInstance().createMessage();
-
- // Get the SOAP part and set its content to domSource
- SOAPPart soapPart = message.getSOAPPart();
- soapPart.setContent(domSource);
- message.saveChanges();
+ public void _testInputEncoding() throws Exception {
+ DOMSource domSource;
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = builder.parse(new File(System.getProperty("basedir", ".") +
+ "/test-resources" + File.separator + "soap-part.xml"));
+ domSource = new DOMSource(document);
+
+ SOAPMessage message = MessageFactory.newInstance().createMessage();
+
+ // Get the SOAP part and set its content to domSource
+ SOAPPart soapPart = message.getSOAPPart();
+ soapPart.setContent(domSource);
+ message.saveChanges();
- SOAPPart sp = message.getSOAPPart();
+ SOAPPart sp = message.getSOAPPart();
// String inputEncoding = sp.getInputEncoding();
// assertNotNull(inputEncoding);
- } catch (Exception e) {
- fail("Unexpected Exception " + e);
- }
}
/**