1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.submit.filters;
14
15 import com.eviware.soapui.impl.wsdl.WsdlSubmitContext;
16 import com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpRequestTransport;
17
18 import junit.framework.TestCase;
19
20 public class RemoveEmptyContentRequestFilterTestCase extends TestCase
21 {
22 public void testRemoval() throws Exception
23 {
24 doRemoval( "<test><testing/></test>", "<test/>" );
25 doRemoval( "<test><testing test=\"\"/></test>", "<test/>" );
26
27 doRemoval( "<test><testing> </testing></test>", "<test/>" );
28 doRemoval( "<test><testing> <testar test=\"\"></testar> </testing></test>",
29 "<test><testing> </testing></test>" );
30
31 doRemoval( "<test><testing>\n <testar test=\"\"></testar>\n </testing></test>",
32 "<test><testing>\n \n </testing></test>" );
33
34 doRemoval( "<test></test>", "<test></test>" );
35
36 doRemoval( "<test><testing></test>", "<test><testing></test>" );
37 }
38
39 public void doRemoval( String request, String expected ) throws Exception
40 {
41 RemoveEmptyContentRequestFilter filter = new RemoveEmptyContentRequestFilter();
42 WsdlSubmitContext context = new WsdlSubmitContext();
43
44
45 context.setProperty( BaseHttpRequestTransport.REQUEST_CONTENT , request );
46
47 filter.filterRequest( context, null );
48
49 assertEquals( expected, context.getProperty( BaseHttpRequestTransport.REQUEST_CONTENT ) );
50 }
51 }