Index: TestCookie.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
retrieving revision 1.3
diff -c -r1.3 TestCookie.java
*** TestCookie.java	4 Feb 2002 15:26:43 -0000	1.3
--- TestCookie.java	7 Feb 2002 06:52:09 -0000
***************
*** 73,78 ****
--- 73,79 ----
   *
   * @author BC Holmes
   * @author Rod Waldhoff
+  * @author Sean C. Sullivan
   * @version $Revision: 1.3 $
   */
  public class TestCookie extends TestCase {
***************
*** 297,302 ****
--- 298,342 ----
          assertTrue("Secure",parsed[0].getSecure());
          assertTrue("ExpiryDate",null == parsed[0].getExpiryDate());
          assertTrue("Comment",null == parsed[0].getComment());
+     }
+ 
+     
+     public void testDateMutability() throws Exception {
+ 
+ 	final long time = System.currentTimeMillis();
+ 
+ 	final Date initialExpiryDate = new Date(time);
+ 
+ 	final Cookie c = new Cookie(DOMAIN_NAME,
+ 				"cookie-name",
+ 				"cookie-value",
+ 				"/" /* path */,
+ 				initialExpiryDate,
+ 				false /* secure */);
+ 
+ 	// modify the state of the initialExpiryDate object
+ 	initialExpiryDate.setTime(time + 1);
+ 
+ 	Date returnedDate1 = c.getExpiryDate();
+ 
+ 	assertEquals(time, returnedDate1.getTime());
+ 
+ 	// we are directly comparing the object references.
+ 	// They should be different objects:
+ 	assertTrue(initialExpiryDate != returnedDate1);
+ 	
+ 	// modify the state of the returnedDate1 object
+ 	final int delta = 2;
+ 	returnedDate1.setTime(time + delta);
+ 
+ 	Date returnedDate2 = c.getExpiryDate();
+ 
+ 	assertEquals(delta, (returnedDate1.getTime() - returnedDate2.getTime()));
+ 
+ 	// we are directly comparing the object references.
+ 	// They should be different objects:
+ 	assertTrue(returnedDate1 != returnedDate2);
+ 	
      }
  
      public void testParseWithComment() throws Exception {
