Save This Page
Home » cactus-1.8.0-src » org.apache.cactus.sample.servlet.unit » [javadoc | source]
org.apache.cactus.sample.servlet.unit
public class: TestHttpResponse [javadoc | source]
java.lang.Object
   junit.framework.TestCase
      org.apache.cactus.internal.AbstractCactusTestCase
         org.apache.cactus.ServletTestCase
            org.apache.cactus.sample.servlet.unit.TestHttpResponse

All Implemented Interfaces:
    CactusTestCase

Tests that writes to the HTTP response.
Fields inherited from org.apache.cactus.ServletTestCase:
request,  response,  session,  config
Method from org.apache.cactus.sample.servlet.unit.TestHttpResponse Summary:
beginGetReader,   endGetResponseAsStringArrayMultiLines,   endGetResponseAsText,   endNoContentResponseCode,   endRedirect,   endSetContentType,   endStatusCode,   endWriteOutputStream,   testGetReader,   testGetResponseAsStringArrayMultiLines,   testGetResponseAsText,   testNoContentResponseCode,   testRedirect,   testSetContentType,   testStatusCode,   testWriteOutputStream
Methods from org.apache.cactus.ServletTestCase:
createProtocolHandler
Methods from org.apache.cactus.internal.AbstractCactusTestCase:
createProtocolHandler,   runBare,   runBareServer
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cactus.sample.servlet.unit.TestHttpResponse Detail:
 public  void beginGetReader(WebRequest theRequest) 
    Verify that a test case can get the request body by calling HttpServletRequest.getReader(). In other words, verify that internal parameters that Cactus passes from its client side to the server do not affect this ability.
 public  void endGetResponseAsStringArrayMultiLines(WebResponse theResponse) throws IOException 
    Verify that the getTextAsArray() method works with output text sent on multiple lines. We also verify that we can call it several times with the same result.
 public  void endGetResponseAsText(WebResponse theResponse) throws IOException 
    Verify that the WebResponse.getText() method works.
 public  void endNoContentResponseCode(WebResponse theResponse) 
    Verify that we can return a NO_CONTENT response.
 public  void endRedirect(WebResponse theResponse) throws IOException 
    Verify that we can assert HTTP status code when it is a redirect and that the client side of Cactus does not follow the redirect.
 public  void endSetContentType(WebResponse theResponse) 
    Verify we can set and retrieve the content type.
 public  void endStatusCode(WebResponse theResponse) throws IOException 
    Verify that we can assert HTTP status code when it is an error status code (> 400). Note: HttpURLConnection will return a FileNotFoundException if the status code is > 400 and the request does not end with a "/" !
 public  void endWriteOutputStream(WebResponse theResponse) throws IOException 
    Verify that it is possible to write to the servlet output stream.
 public  void testGetReader() throws Exception 
    Verify that a test case can get the request body by calling HttpServletRequest.getReader(). In other words, verify that internal parameters that Cactus passes from its client side to the server do not affect this ability.
 public  void testGetResponseAsStringArrayMultiLines() throws IOException 
    Verify that the getTextAsArray() method works with output text sent on multiple lines. We also verify that we can call it several times with the same result.
 public  void testGetResponseAsText() throws IOException 
    Verify that the WebResponse.getText() method works.
 public  void testNoContentResponseCode() 
    Verify that we can return a NO_CONTENT response.
 public  void testRedirect() throws IOException 
    Verify that we can assert HTTP status code when it is a redirect and that the client side of Cactus does not follow the redirect.
 public  void testSetContentType() throws Exception 
    Verify we can set and retrieve the content type.
 public  void testStatusCode() 
    Verify that we can assert HTTP status code when it is an error status code (> 400). Note: HttpURLConnection will return a FileNotFoundException if the status code is > 400 and the request does not end with a "/" !
 public  void testWriteOutputStream() throws IOException 
    Verify that it is possible to write to the servlet output stream.