1 16 package org.apache.axis2.om; 17 18 import org.apache.axis2.soap.SOAPBody; 19 import org.apache.axis2.soap.impl.llom.SOAPProcessingException; 20 21 public class OMBodyTest extends OMTestCase implements OMConstants { 22 SOAPBody soapBody; 23 24 public OMBodyTest(String testName) { 25 super(testName); 26 } 27 28 31 protected void setUp() throws Exception { 32 super.setUp(); 33 soapBody = soapEnvelope.getBody(); 34 } 35 36 39 public void testAddFault() { 40 System.out.println("Adding SOAP fault to body ...."); 41 try { 42 soapBody.addChild(soapFactory.createSOAPFault(soapBody, new Exception ("Testing soap fault"))); 43 } catch (SOAPProcessingException e) { 44 e.printStackTrace(); 45 fail(e.getMessage()); 46 } 47 System.out.println("\t checking for SOAP Fault ..."); 48 assertTrue("SOAP body has no SOAP fault", soapBody.hasFault()); 49 System.out.println("\t checking for not-nullity ..."); 50 assertTrue("SOAP body has no SOAP fault", soapBody.getFault() != null); 51 52 } 55 56 } 57 | Popular Tags |