1 20 package org.apache.cactus.sample.servlet.unit; 21 22 import java.io.IOException ; 23 import java.io.PrintWriter ; 24 25 import org.apache.cactus.ServletTestCase; 26 27 32 public class TestHttpUnitIntegration extends ServletTestCase 33 { 34 39 public void testHttpUnitGetText() throws IOException 40 { 41 PrintWriter pw = response.getWriter(); 42 43 pw.print("something to return for the test"); 44 } 45 46 53 public void endHttpUnitGetText( 54 com.meterware.httpunit.WebResponse theResponse) throws IOException 55 { 56 String text = theResponse.getText(); 57 58 assertEquals("something to return for the test", text); 59 } 60 61 63 67 public void testResponseAddHeadersHttpUnit() 68 { 69 response.addHeader("X-Access-Header1", "value1"); 70 response.addHeader("X-Access-Header2", "value2"); 71 } 72 73 79 public void endResponseAddHeadersHttpUnit( 80 com.meterware.httpunit.WebResponse theResponse) 81 { 82 String value1 = theResponse.getHeaderField("X-Access-Header1"); 83 String value2 = theResponse.getHeaderField("X-Access-Header2"); 84 85 assertEquals("value1", value1); 86 assertEquals("value2", value2); 87 } 88 89 } 90 | Popular Tags |