1 16 17 package org.apache.axis2.soap; 18 19 import org.apache.axis2.soap.impl.llom.SOAPConstants; 20 21 public class SOAPBodyTest extends SOAPBodyTestCase { 22 23 public SOAPBodyTest(String testName) { 24 super(testName); 25 } 26 27 protected void setUp() throws Exception { 28 super.setUp(); 29 } 30 31 public void testSOAP11AddFault1() { 33 soap11Body.addFault(new Exception ("This an exception for testing")); 34 assertTrue("SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault", soap11Body.hasFault()); 35 36 } 37 38 public void testSOAP11addFault2() { 39 soap11Body.addFault(soap11Factory.createSOAPFault(soap11Body)); 40 assertTrue("SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",soap11Body.hasFault()); 41 42 43 } 44 45 public void testSOAP11HasFault() { 46 assertFalse("SOAP 1.1 Body Test:- After creating a soap body it has a fault", soap11Body.hasFault()); 47 soap11Body.addFault(new Exception ("This an exception for testing")); 48 assertTrue("SOAP 1.1 Body Test:- After calling addFault method, hasFault method returns false", soap11Body.hasFault()); 49 } 50 51 public void testSOAP11GetFault() { 52 assertTrue("SOAP 1.1 Body Test:- After creating a soap body it has a fault", soap11Body.getFault() == null); 53 soap11Body.addFault(new Exception ("This an exception for testing")); 54 assertFalse("SOAP 1.1 Body Test:- After calling addFault method, getFault method returns null", soap11Body.getFault() == null); 55 } 56 57 public void testSOAP12AddFault1() { 59 soap12Body.addFault(new Exception ("This an exception for testing")); 60 assertTrue("SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault", soap12Body.hasFault()); 61 62 } 63 64 public void testSOAP12AddFault2() { 65 soap12Body.addFault(soap12Factory.createSOAPFault(soap12Body)); 66 assertTrue("SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",soap12Body.hasFault()); 67 } 68 69 public void testSOAP12HasFault() { 70 assertFalse("SOAP 1.2 Body Test:- After creating a soap body it has a fault", soap12Body.hasFault()); 71 soap12Body.addFault(new Exception ("This an exception for testing")); 72 assertTrue("SOAP 1.2 Body Test:- After calling addFault method, hasFault method returns false", soap12Body.hasFault()); 73 } 74 75 public void testSOAP12GetFault() { 76 assertTrue("SOAP 1.2 Body Test:- After creating a soap body it has a fault", soap12Body.getFault() == null); 77 soap12Body.addFault(new Exception ("This an exception for testing")); 78 assertFalse("SOAP 1.2 Body Test:- After calling addFault method, getFault method returns null", soap12Body.getFault() == null); 79 } 80 81 public void testSOAP11HasFaultWithParser() { 83 assertTrue("SOAP 1.1 Body Test With parser :- hasFault method returns false", soap11BodyWithParser.hasFault()); 84 } 85 86 public void testSOAP11GetFaultWithParser() { 87 assertFalse("SOAP 1.1 Body Test With parser :- getFault method returns null", soap11BodyWithParser.getFault() == null); 88 assertTrue("SOAP 1.1 Body Test With parser : - SOAP fault name mismatch",soap11BodyWithParser.getFault().getLocalName().equals(SOAPConstants.SOAPFAULT_LOCAL_NAME)); 89 } 90 91 public void testSOAP12HasFaultWithParser() { 93 assertTrue("SOAP 1.2 Body Test With parser :- hasFault method returns false", soap12BodyWithParser.hasFault()); 94 } 95 96 public void testSOAP12GetFaultWithParser() { 97 assertFalse("SOAP 1.2 Body Test With parser :- getFault method returns null", soap12BodyWithParser.getFault() == null); 98 assertTrue("SOAP 1.2 Body Test With parser : - SOAP fault name mismatch",soap12BodyWithParser.getFault().getLocalName().equals(SOAPConstants.SOAPFAULT_LOCAL_NAME)); 99 } 100 } 101 | Popular Tags |