SOAPFault soapFault = sfe.getFault();
assertTrue(soapFault != null);
assertTrue(soapFault.getFaultString().equals("hello world2"));
assertTrue(soapFault.getFaultActor().equals("actor2"));
assertTrue(soapFault.getDetail() != null);
DetailEntry de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
assertTrue(de != null);
assertTrue(de.getNamespaceURI().equals("urn://sample"));
assertTrue(de.getLocalName().equals("detailEntry"));
assertTrue(de.getValue().equals("Texas"));
// Repeat to verify behavior
try{
exception = null;
// the invoke will throw an exception, if the test is performed right
int total = proxy.throwFault(2, "SOAPFaultException2", 2); // "SOAPFaultException" will cause service to throw SOAPFaultException
}catch(SOAPFaultException e){
// Okay
exception = e;
} catch (Exception e) {
fail("Did not get a SOAPFaultException");
}
TestLogger.logger.debug("----------------------------------");
assertNotNull(exception);
sfe = (SOAPFaultException) exception;
soapFault = sfe.getFault();
assertTrue(soapFault != null);
assertTrue(soapFault.getFaultString().equals("hello world2"));
assertTrue(soapFault.getFaultActor().equals("actor2"));
assertTrue(soapFault.getDetail() != null);
de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
assertTrue(de != null);
assertTrue(de.getNamespaceURI().equals("urn://sample"));
assertTrue(de.getLocalName().equals("detailEntry"));
assertTrue(de.getValue().equals("Texas"));
}