use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestCreateSOAPFaultWithException method runTest.
@Override
protected void runTest() throws Throwable {
SOAPBody body = withParent ? soapFactory.getDefaultEnvelope().getBody() : null;
SOAPFault fault = soapFactory.createSOAPFault(body, new Exception("Testing soap fault"));
if (body != null) {
assertThat(body.hasFault()).isTrue();
assertThat(body.getFault()).isSameAs(fault);
}
assertThat(fault.isComplete()).isTrue();
SOAPFaultDetail detail = fault.getDetail();
assertThat(detail).isNotNull();
Iterator<OMElement> it = detail.getAllDetailEntries();
assertThat(it.hasNext()).isTrue();
OMElement entry = it.next();
assertThat(entry.getQName()).isEqualTo(new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
assertThat(entry.getText()).contains("Testing soap fault");
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestWrongParent1 method runTest.
@Override
protected void runTest() throws Throwable {
SOAPFaultCode parent = soapFactory.createSOAPFaultCode();
SOAPFault fault = soapFactory.createSOAPFault();
try {
parent.addChild(fault);
fail("Expected SOAPProcessingException");
} catch (SOAPProcessingException ex) {
// Expected
}
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestSetException method runTest.
@Override
protected void runTest() throws Throwable {
SOAPFault fault = soapFactory.createSOAPFault();
Exception exception = new Exception("Test exception message");
fault.setException(exception);
SOAPFaultDetail detail = fault.getDetail();
assertNotNull(detail);
Iterator<OMElement> it = detail.getAllDetailEntries();
assertTrue(it.hasNext());
OMElement entry = it.next();
assertNotNull(entry);
assertEquals(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, entry.getLocalName());
assertNull(entry.getNamespace());
String text = entry.getText();
assertTrue(text.startsWith(Exception.class.getName() + ": Test exception message"));
assertTrue(text.contains("at " + TestSetException.class.getName()));
assertFalse(it.hasNext());
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestGetValueAsQName method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.getDefaultEnvelope();
SOAPFault fault = soapFactory.createSOAPFault(env.getBody());
SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
QName value = new QName("urn:test", "myFaultCode");
code.setValue(value);
assertEquals(value, code.getValueAsQName());
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestGetCodeWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPFault soapFaultWithParser = envelope.getBody().getFault();
assertNotNull("Fault Test with parser: - getCode method returns null", soapFaultWithParser.getCode());
assertEquals("Fault Test with parser: - Fault code local name mismatch", spec.getFaultCodeQName(), soapFaultWithParser.getCode().getQName());
}
Aggregations