commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marcs...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestHttpUrlMethod.java
Date Mon, 22 Apr 2002 03:14:47 GMT
marcsaeg    02/04/21 20:14:47

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestHttpUrlMethod.java
  Log:
  Added some tests for constructors that specify a URL.
  
  Revision  Changes    Path
  1.2       +66 -3     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpUrlMethod.java
  
  Index: TestHttpUrlMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpUrlMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestHttpUrlMethod.java	28 Mar 2002 03:59:06 -0000	1.1
  +++ TestHttpUrlMethod.java	22 Apr 2002 03:14:47 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpUrlMethod.java,v
1.1 2002/03/28 03:59:06 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/03/28 03:59:06 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpUrlMethod.java,v
1.2 2002/04/22 03:14:47 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/04/22 03:14:47 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -74,7 +74,7 @@
    * do not require any network connection or web app.
    *
    * @author Marc A. Saegesser
  - * @version $Id: TestHttpUrlMethod.java,v 1.1 2002/03/28 03:59:06 marcsaeg Exp $
  + * @version $Id: TestHttpUrlMethod.java,v 1.2 2002/04/22 03:14:47 marcsaeg Exp $
    */
   public class TestHttpUrlMethod extends TestCase {
   
  @@ -97,6 +97,69 @@
   
   
       // ----------------------------------------------------------- Test Methods
  +
  +    // Test constructors
  +    public void testUrlDeleteMethodConstructor() {
  +        try{
  +            UrlDeleteMethod method = new UrlDeleteMethod("http://www.fubar.com/path1/path2?query=string");
  +            validateConstructorResults(method);
  +        }catch(MalformedURLException e){
  +            fail("Caught unexpected exception " + e.toString());
  +        }
  +    }
  +
  +    public void testUrlGetMethodConstructor() {
  +        try{
  +            UrlGetMethod method = new UrlGetMethod("http://www.fubar.com/path1/path2?query=string");
  +            validateConstructorResults(method);
  +        }catch(MalformedURLException e){
  +            fail("Caught unexpected exception " + e.toString());
  +        }
  +    }
  +
  +    public void testUrlHeadMethodConstructor() {
  +        try{
  +            UrlHeadMethod method = new UrlHeadMethod("http://www.fubar.com/path1/path2?query=string");
  +            validateConstructorResults(method);
  +        }catch(MalformedURLException e){
  +            fail("Caught unexpected exception " + e.toString());
  +        }
  +    }
  +
  +    public void testUrlOptionsMethodConstructor() {
  +        try{
  +            UrlOptionsMethod method = new UrlOptionsMethod("http://www.fubar.com/path1/path2?query=string");
  +            validateConstructorResults(method);
  +        }catch(MalformedURLException e){
  +            fail("Caught unexpected exception " + e.toString());
  +        }
  +    }
  +
  +    public void testUrlPostMethodConstructor() {
  +        try{
  +            UrlPostMethod method = new UrlPostMethod("http://www.fubar.com/path1/path2?query=string");
  +            validateConstructorResults(method);
  +        }catch(MalformedURLException e){
  +            fail("Caught unexpected exception " + e.toString());
  +        }
  +    }
  +
  +    public void testUrlPutMethodConstructor() {
  +        try{
  +            UrlPutMethod method = new UrlPutMethod("http://www.fubar.com/path1/path2?query=string");
  +            validateConstructorResults(method);
  +        }catch(MalformedURLException e){
  +            fail("Caught unexpected exception " + e.toString());
  +        }
  +    }
  +
  +    private void validateConstructorResults(HttpUrlMethod method)
  +    {
  +        assertEquals("Get URL", "http://www.fubar.com/path1/path2?query=string", method.getUrl());
  +        assertEquals("Get Path", "/path1/path2", method.getPath());
  +        assertEquals("Get query string", "query=string", method.getQueryString());
  +    }
  +
   
       // Test UrlDeleteMethod
       public void testUrlDeleteMethodAccessorsValidPath() {
  
  
  

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


Mime
View raw message