ErrorCode ec = new ErrorCode();
ec.setMajor((short)1);
ec.setMinor((short)1);
NoSuchCodeLit nscl = new NoSuchCodeLit();
nscl.setCode(ec);
NoSuchCodeLitFault ex = new NoSuchCodeLitFault(exMessage, nscl);
objContext.setException(ex);
binding.marshalFault(objContext,
soapContext,
new JAXBDataBindingCallback(objContext.getMethod(),
DataBindingCallback.Mode.PARTS,
null));
SOAPMessage msg = soapContext.getMessage();
assertNotNull(msg);
Node xmlNode = msg.getSOAPBody();
assertNotNull(xmlNode);
assertEquals(1, xmlNode.getChildNodes().getLength());
assertTrue(msg.getSOAPBody().hasFault());
SOAPFault fault = msg.getSOAPBody().getFault();
assertNotNull(fault);
assertEquals(
getExceptionString(ex, exMessage),
fault.getFaultString());
assertTrue(fault.hasChildNodes());
Detail detail = fault.getDetail();
assertNotNull(detail);
NodeList list = detail.getChildNodes();
assertEquals(1, list.getLength());
WebFault wfAnnotation = ex.getClass().getAnnotation(WebFault.class);
assertEquals(wfAnnotation.targetNamespace(), list.item(0).getNamespaceURI());
assertEquals(wfAnnotation.name(), list.item(0).getLocalName());
}