vmassol     02/01/10 11:58:31

  Modified:    src/sample/share/org/apache/cactus/sample
                        TestSampleServlet.java
  Log:
  * now it compiles on JDK 1.2. Thanks to Balki.
  * added new test case to test includes
  
  Revision  Changes    Path
  1.13      +42 -6     
jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServlet.java
  
  Index: TestSampleServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/src/sample/share/org/apache/cactus/sample/TestSampleServlet.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestSampleServlet.java    19 Oct 2001 23:06:35 -0000      1.12
  +++ TestSampleServlet.java    10 Jan 2002 19:58:30 -0000      1.13
  @@ -68,7 +68,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Massol</a>
    *
  - * @version $Id: TestSampleServlet.java,v 1.12 2001/10/19 23:06:35 vmassol Exp $
  + * @version $Id: TestSampleServlet.java,v 1.13 2002/01/10 19:58:30 vmassol Exp $
    */
   public class TestSampleServlet extends ServletTestCase
   {
  @@ -362,8 +362,11 @@
        * client side.
        *
        * @param theResponse the response from the server side.
  +     *
  +     * @exception Exception for backward compatibility with JDK 1.2.2 (not
  +     *            needed for JDK 1.3+, but needed for URLDecoder.decode())
        */
  -    public void endReceiveCookie(WebResponse theResponse)
  +    public void endReceiveCookie(WebResponse theResponse) throws Exception
       {
           Cookie cookie = theResponse.getCookie("responsecookie");
   
  @@ -384,9 +387,10 @@
   
       /**
        * Verify that we can use a <code>RequestDispatcher</code> in the class to
  -     * test and compare the result sent to the output stream on the client side.
  +     * test to forward to another page and compare the result sent to the 
  +     * output stream on the client side.
        */
  -    public void testRequestDispatcher() throws Exception
  +    public void testRequestDispatcherForward() throws Exception
       {
           SampleServlet servlet = new SampleServlet();
           servlet.doForward(request, response, config);
  @@ -394,14 +398,46 @@
   
       /**
        * Verify that we can use a <code>RequestDispatcher</code> in the class to
  -     * test and compare the result sent to the output stream on the client side.
  +     * test to forward to another page and compare the result sent to the 
  +     * output stream on the client side.
        *
        * @param theResponse the response from the server side.
        */
  -    public void endRequestDispatcher(WebResponse theResponse)
  +    public void endRequestDispatcherForward(WebResponse theResponse)
           throws IOException
       {
           // We cannot test what is exactly returned by the called JSP between
  +        // different Servlet engine return different text ! For example some
  +        // return the JSP comment, other do not, ...
  +        // Thus, we only test for a match of "Hello !"
  +        assert("Text missing 'Hello !' : [" + theResponse.getText() + "]",
  +            theResponse.getText().indexOf("Hello !") > 0);
  +    }
  +
  +    //-------------------------------------------------------------------------
  +
  +    /**
  +     * Verify that we can use a <code>RequestDispatcher</code> in the class to
  +     * test to include another page and compare the result sent to the 
  +     * output stream on the client side.
  +     */
  +    public void testRequestDispatcherInclude() throws Exception
  +    {
  +        SampleServlet servlet = new SampleServlet();
  +        servlet.doInclude(request, response, config);
  +    }
  +
  +    /**
  +     * Verify that we can use a <code>RequestDispatcher</code> in the class to
  +     * test to include another page and compare the result sent to the 
  +     * output stream on the client side.
  +     *
  +     * @param theResponse the response from the server side.
  +     */
  +    public void endRequestDispatcherInclude(WebResponse theResponse)
  +        throws IOException
  +    {
  +        // We cannot test what is exactly returned by the included JSP between
           // different Servlet engine return different text ! For example some
           // return the JSP comment, other do not, ...
           // Thus, we only test for a match of "Hello !"
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to