You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by su...@apache.org on 2002/09/05 06:44:04 UTC

cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestHttpState.java

sullis      2002/09/04 21:44:04

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestHttpState.java
  Log:
  added method: testToString
  updated copyright year
  instance variables are now final
  updated javadocs
  
  Revision  Changes    Path
  1.2       +32 -10    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpState.java
  
  Index: TestHttpState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpState.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestHttpState.java	16 Jul 2002 02:54:30 -0000	1.1
  +++ TestHttpState.java	5 Sep 2002 04:44:04 -0000	1.2
  @@ -6,7 +6,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -65,19 +65,23 @@
   import junit.framework.*;
   
   /**
  - * Simple tests for {@link NameValuePair}.
  + * 
  + * Simple tests for {@link HttpState}.
    *
    * @author Rodney Waldhoff
    * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
  + * @author Sean C. Sullivan
  + * 
    * @version $Id$
  + * 
    */
   public class TestHttpState extends TestCase {
   
  -    public Credentials creds1 = new UsernamePasswordCredentials("user1", "pass1");
  -    public Credentials creds2 = new UsernamePasswordCredentials("user2", "pass2");
  +    public final Credentials creds1 = new UsernamePasswordCredentials("user1", "pass1");
  +    public final Credentials creds2 = new UsernamePasswordCredentials("user2", "pass2");
   
  -    public String realm1 = "realm1";
  -    public String realm2 = "realm2";
  +    public final String realm1 = "realm1";
  +    public final String realm2 = "realm2";
   
   
       // ------------------------------------------------------------ Constructor
  @@ -107,6 +111,24 @@
           assertEquals(creds1, state.getCredentials(realm1));
           assertEquals(creds2, state.getCredentials(realm2));
       }
  +
  +	public void testToString()
  +	{
  +        HttpState state = new HttpState();
  +        assertNotNull(state.toString());
  +        
  +        state.addCookie(new Cookie("foo", "bar", "yeah"));
  +        assertNotNull(state.toString());
  +
  +        state.addCookie(new Cookie("flub", "duck", "yuck"));
  +        assertNotNull(state.toString());
  +
  +		state.setCredentials(realm1, creds1);
  +        assertNotNull(state.toString());
  +        
  +		state.setProxyCredentials(realm2, creds2);
  +        assertNotNull(state.toString());
  +	}
   
       public void testHttpStateNoCredentials() {
           HttpState state = new HttpState();
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>