Author: veithen
Date: Sun Aug 23 21:38:14 2015
New Revision: 1697261
URL: http://svn.apache.org/r1697261
Log:
Fix a TODO item.
Added:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithException.java
- copied, changed from r1697242,
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithParent.java
Removed:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithParent.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestCloneWithException.java
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1697261&r1=1697260&r2=1697261&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Sun Aug 23 21:38:14 2015
@@ -180,7 +180,8 @@ public class SOAPTestSuiteBuilder extend
}
}
}
- addTest(new
org.apache.axiom.ts.soap.factory.TestCreateSOAPFaultWithParent(metaFactory,
spec));
+ addTest(new
org.apache.axiom.ts.soap.factory.TestCreateSOAPFaultWithException(metaFactory,
spec, true));
+ addTest(new
org.apache.axiom.ts.soap.factory.TestCreateSOAPFaultWithException(metaFactory,
spec, false));
addTest(new
org.apache.axiom.ts.soap.factory.TestFactoryIsSingleton(metaFactory, spec));
addTest(new
org.apache.axiom.ts.soap.factory.TestGetDefaultEnvelope(metaFactory, spec));
addTest(new
org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope(metaFactory,
spec));
@@ -192,7 +193,6 @@ public class SOAPTestSuiteBuilder extend
addTest(new
org.apache.axiom.ts.soap.fault.TestChildOrder(metaFactory, spec,
new SOAPFaultChild[] { SOAPFaultChild.CODE,
SOAPFaultChild.REASON, SOAPFaultChild.DETAIL, SOAPFaultChild.REASON }, ss));
}
- addTest(new
org.apache.axiom.ts.soap.fault.TestCloneWithException(metaFactory, spec));
addTest(new
org.apache.axiom.ts.soap.fault.TestGetCodeWithParser(metaFactory, spec));
addTest(new
org.apache.axiom.ts.soap.fault.TestGetDetailWithParser(metaFactory, spec));
addTest(new
org.apache.axiom.ts.soap.fault.TestGetException(metaFactory, spec));
Copied:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithException.java
(from r1697242,
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithParent.java)
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithException.java?p2=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithException.java&p1=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithParent.java&r1=1697242&r2=1697261&rev=1697261&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithParent.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPFaultWithException.java
Sun Aug 23 21:38:14 2015
@@ -18,23 +18,44 @@
*/
package org.apache.axiom.ts.soap.factory;
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPConstants;
import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultDetail;
import org.apache.axiom.ts.soap.SOAPSpec;
import org.apache.axiom.ts.soap.SOAPTestCase;
-public class TestCreateSOAPFaultWithParent extends SOAPTestCase {
- public TestCreateSOAPFaultWithParent(OMMetaFactory metaFactory, SOAPSpec
spec) {
+public class TestCreateSOAPFaultWithException extends SOAPTestCase {
+ private final boolean withParent;
+
+ public TestCreateSOAPFaultWithException(OMMetaFactory metaFactory,
SOAPSpec spec, boolean withParent) {
super(metaFactory, spec);
+ this.withParent = withParent;
+ addTestParameter("withParent", withParent);
}
protected void runTest() throws Throwable {
- SOAPBody body = soapFactory.getDefaultEnvelope().getBody();
+ SOAPBody body = withParent ?
soapFactory.getDefaultEnvelope().getBody() : null;
SOAPFault fault = soapFactory.createSOAPFault(body, new
Exception("Testing soap fault"));
- assertTrue("SOAP body has no SOAP fault", body.hasFault());
- assertSame("SOAP body has no SOAP fault", fault, body.getFault());
- assertTrue("Programatically created SOAPFault should have done = true",
- fault.isComplete());
+ if (body != null) {
+ assertThat(body.hasFault()).isTrue();
+ assertThat(body.getFault()).isSameAs(fault);
+ }
+ assertThat(fault.isComplete()).isTrue();
+ SOAPFaultDetail detail = fault.getDetail();
+ assertThat(detail).isNotNull();
+ Iterator it = detail.getAllDetailEntries();
+ assertThat(it.hasNext()).isTrue();
+ OMElement entry = (OMElement)it.next();
+ assertThat(entry.getQName()).isEqualTo(new
QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
+ assertThat(entry.getText()).contains("Testing soap fault");
}
}