dion 02/02/18 15:42:08
Modified: httpclient/src/test/org/apache/commons/httpclient
TestCookie.java
Log:
Added more null tests
Revision Changes Path
1.6 +80 -4
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java
Index: TestCookie.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestCookie.java 18 Feb 2002 02:43:16 -0000 1.5
+++ TestCookie.java 18 Feb 2002 23:42:07 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
1.5 2002/02/18 02:43:16 dion Exp $
- * $Revision: 1.5 $
- * $Date: 2002/02/18 02:43:16 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
1.6 2002/02/18 23:42:07 dion Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/02/18 23:42:07 $
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -79,7 +79,7 @@
* @author Rod Waldhoff
* @author dIon Gillard
* @author <a href="mailto:[EMAIL PROTECTED]">John Evans</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class TestCookie extends TestCase {
@@ -478,6 +478,82 @@
// null path
Cookie[] parsed = Cookie.parse(null, null, true, setCookie);
assertNull(parsed[0].getDomain());
+ }
+
+ /** Call Cookie.createCookieHeader providing null for domain to match on
+ */
+ public void testCreateCookieHeaderWithNullDomain() throws Exception {
+ Header setCookie = new Header("Set-Cookie",
+ TEST_COOKIE + SEP + OLD_EXPIRY);
+ Cookie[] parsed = Cookie.parse(DOMAIN_NAME, ROOT_PATH, true, setCookie);
+
+ Header header = Cookie.createCookieHeader(null, ROOT_PATH, false, parsed);
+ assertNotNull(header);
+ }
+
+ /** Call Cookie.createCookieHeader providing null for path to match on
+ */
+ public void testCreateCookieHeaderWithNullPath() throws Exception {
+ Header setCookie = new Header("Set-Cookie",
+ TEST_COOKIE + SEP + OLD_EXPIRY);
+ Cookie[] parsed = Cookie.parse(DOMAIN_NAME, ROOT_PATH, false, setCookie);
+
+ Header header = Cookie.createCookieHeader(DOMAIN_NAME, null, false, parsed);
+ assertNotNull(header);
+ }
+
+ /** Call Cookie.createCookieHeader providing null for domain and path to
+ * match on
+ */
+ public void testCreateCookieHeaderWithNullDomainAndPath() throws Exception {
+ Header setCookie = new Header("Set-Cookie",
+ TEST_COOKIE + SEP + OLD_EXPIRY);
+ Cookie[] parsed = Cookie.parse(DOMAIN_NAME, ROOT_PATH, true, setCookie);
+
+ Header header = Cookie.createCookieHeader(null, null, false, parsed);
+ assertNotNull(header);
+ }
+
+ /** Call Cookie.createCookieHeader providing null for domain of
+ * a cookie in the array
+ */
+ public void testCreateCookieHeaderWithNullDomainCookie() throws Exception {
+ Cookie c1 = new Cookie(null, "cookieName", "cookieValue");
+ Cookie c2 = new Cookie(DOMAIN_NAME, "cookieName", "cookieValue");
+ Cookie[] parsed = new Cookie[] {c1, c2};
+
+ Header header = Cookie.createCookieHeader(DOMAIN_NAME, ROOT_PATH,
+ false, parsed);
+ assertNotNull(header);
+ }
+
+ /** Call Cookie.createCookieHeader providing null for path of
+ * a cookie in the array
+ */
+ public void testCreateCookieHeaderWithNullPathCookie() throws Exception {
+ Cookie c1 = new Cookie(DOMAIN_NAME, "cookieName", "cookieValue", null, -1,
+ false);
+ Cookie c2 = new Cookie(DOMAIN_NAME, "cookieName", "cookieValue");
+ Cookie[] parsed = new Cookie[] {c1, c2};
+
+ Header header = Cookie.createCookieHeader(DOMAIN_NAME, ROOT_PATH, false,
+ parsed);
+ assertNotNull(header);
+ }
+
+ /** Call Cookie.createCookieHeader providing null for domain and path of
+ * a cookie in the array
+ */
+ public void testCreateCookieHeaderWithNullDomainAndPathCookie() throws
Exception {
+ Header setCookie = new Header("Set-Cookie",
+ TEST_COOKIE + SEP + OLD_EXPIRY);
+ Cookie c1 = new Cookie(null, "cookieName", "cookieValue", null, -1,
+ false);
+ Cookie c2 = new Cookie(DOMAIN_NAME, "cookieName", "cookieValue");
+ Cookie[] parsed = new Cookie[] {c1, c2};
+
+ Header header = Cookie.createCookieHeader(DOMAIN_NAME, ROOT_PATH, false,
parsed);
+ assertNotNull(header);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>