hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r409989 - in /jakarta/httpcomponents/httpclient/trunk/src/test/org/apache: http/cookie/TestAllCookie.java http/cookie/TestCookieOrigin.java http/cookie/TestCookiePathComparator.java httpclient/TestAll.java
Date Sun, 28 May 2006 20:09:15 GMT
Author: olegk
Date: Sun May 28 13:09:14 2006
New Revision: 409989

URL: http://svn.apache.org/viewvc?rev=409989&view=rev
Log:
More test coverage

Added:
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
  (with props)
Modified:
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestAllCookie.java
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookiePathComparator.java
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/TestAll.java

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestAllCookie.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestAllCookie.java?rev=409989&r1=409988&r2=409989&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestAllCookie.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestAllCookie.java
Sun May 28 13:09:14 2006
@@ -38,6 +38,7 @@
 
     public static Test suite() {
         TestSuite suite = new TestSuite();
+        suite.addTest(TestCookieOrigin.suite());
         suite.addTest(TestCookiePathComparator.suite());
         return suite;
     }

Added: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java?rev=409989&view=auto
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
(added)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
Sun May 28 13:09:14 2006
@@ -0,0 +1,102 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ * ====================================================================
+ *
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.cookie;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test cases for {@link CookieOrigin}.
+ */
+public class TestCookieOrigin extends TestCase {
+
+
+    // ------------------------------------------------------------ Constructor
+
+    public TestCookieOrigin(String name) {
+        super(name);
+    }
+
+    // ------------------------------------------------------- TestCase Methods
+
+    public static Test suite() {
+        return new TestSuite(TestCookieOrigin.class);
+    }
+
+    public void testConstructor() {
+        CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
+        assertEquals("www.apache.org", origin.getHost());
+        assertEquals(80, origin.getPort());
+        assertEquals("/", origin.getPath());
+        assertFalse(origin.isSecure());
+    }
+
+    public void testNullHost() {
+        try {
+            new CookieOrigin(null, 80, "/", false);
+        } catch (IllegalArgumentException ex) {
+            // expected
+        }
+    }
+    
+    public void testEmptyHost() {
+        try {
+            new CookieOrigin("   ", 80, "/", false);
+        } catch (IllegalArgumentException ex) {
+            // expected
+        }
+    }
+
+    public void testNegativePort() {
+        try {
+            new CookieOrigin("www.apache.org", -80, "/", false);
+        } catch (IllegalArgumentException ex) {
+            // expected
+        }
+    }
+
+    public void testNullPath() {
+        try {
+            new CookieOrigin("www.apache.org", 80, null, false);
+        } catch (IllegalArgumentException ex) {
+            // expected
+        }
+    }
+
+    public void testEmptyPath() {
+        CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "", false);
+        assertEquals("www.apache.org", origin.getHost());
+        assertEquals(80, origin.getPort());
+        assertEquals("/", origin.getPath());
+        assertFalse(origin.isSecure());
+    }
+
+}
+

Propchange: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookieOrigin.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookiePathComparator.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookiePathComparator.java?rev=409989&r1=409988&r2=409989&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookiePathComparator.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/TestCookiePathComparator.java
Sun May 28 13:09:14 2006
@@ -1,5 +1,5 @@
 /*
- * $HeaderURL$
+ * $HeadURL$
  * $Revision$
  * $Date$
  * ====================================================================

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/TestAll.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/TestAll.java?rev=409989&r1=409988&r2=409989&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/TestAll.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/TestAll.java Sun
May 28 13:09:14 2006
@@ -28,6 +28,7 @@
 
 package org.apache.httpclient;
 
+import org.apache.http.cookie.TestAllCookie;
 import org.apache.http.cookie.impl.TestAllCookieImpl;
 import org.apache.httpclient.impl.TestAllHttpClientImpl;
 
@@ -41,6 +42,7 @@
 
     public static Test suite() {
         TestSuite suite = new TestSuite();
+        suite.addTest(TestAllCookie.suite());
         suite.addTest(TestAllCookieImpl.suite());
         suite.addTest(TestAllHttpClientImpl.suite());
         return suite;



Mime
View raw message