jakarta-cactus-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vmas...@apache.org
Subject cvs commit: jakarta-cactus/framework/src/test/share/org/apache/cactus TestWebRequest.java
Date Sun, 21 Jul 2002 14:59:03 GMT
vmassol     2002/07/21 07:59:03

  Modified:    framework/src/test/share/org/apache/cactus
                        TestWebRequest.java
  Log:
  WebRequest is now 100% unit tested! :-)
  
  Revision  Changes    Path
  1.3       +24 -4     jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebRequest.java
  
  Index: TestWebRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestWebRequest.java	21 Jul 2002 14:39:14 -0000	1.2
  +++ TestWebRequest.java	21 Jul 2002 14:59:03 -0000	1.3
  @@ -198,6 +198,7 @@
       {
           WebRequest request = new WebRequest();
           request.addHeader("header1", "value1");
  +        request.addHeader("header1", "value2");
           request.addParameter("param1", "value1", WebRequest.GET_METHOD);
           request.addParameter("param1", "value1", WebRequest.POST_METHOD);
           request.addCookie("cookie1", "value1");
  @@ -214,9 +215,28 @@
               + "session = [false], cookies = [[name = [cookie1], value = "
               + "[value1], domain = [localhost], path = [null], isSecure = "
               + "[false], comment = [null], expiryDate = [null]]], headers = "
  -            + "[[[header1] = [[value1]]]], GET parameters = [[[param3] = "
  -            + "[[value3]]][[param2] = [[]]][[param1] = [[value1], [value1]]]], "
  -            + "POST parameters = [[[param1] = [[value1]]]]", result);
  +            + "[[[header1] = [[value1], [value2]]]], GET parameters = "
  +            + "[[[param3] = [[value3]]][[param2] = [[]]][[param1] = [[value1], "
  +            + "[value1]]]], POST parameters = [[[param1] = [[value1]]]]",
  +            result);
  +    }
  +
  +    /**
  +     * Verify that an error in the query string of <code>setURL()</code>
  +     * raises an exception.
  +     */
  +    public void testSetURLBadQueryString()
  +    {
  +        WebRequest request = new WebRequest();
  +
  +        try {
  +            request.setURL("jakarta.apache.org:80", "/catalog", "/garden",
  +                "/implements/", "badquerystring");
  +            fail("Failed to recognize invalid query string");
  +        } catch (RuntimeException e) {
  +            assertEquals("Bad QueryString [badquerystring] NameValue pair: "
  +                + "[badquerystring]", e.getMessage());
  +        }
       }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:cactus-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-dev-help@jakarta.apache.org>


Mime
View raw message