1 /*
2 * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/cookie/TestCookieBase.java,v 1.1 2004/04/24 19:39:24 olegk Exp $
3 * $Revision: 155418 $
4 * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
5 * ====================================================================
6 *
7 * Copyright 1999-2004 The Apache Software Foundation
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ====================================================================
21 *
22 * This software consists of voluntary contributions made by many
23 * individuals on behalf of the Apache Software Foundation. For more
24 * information on the Apache Software Foundation, please see
25 * <http://www.apache.org/>.
26 *
27 */
28
29 package org.apache.commons.httpclient.cookie;
30
31 import junit.framework.TestCase;
32
33 import org.apache.commons.httpclient.Cookie;
34 import org.apache.commons.httpclient.Header;
35
36 /***
37 * Test cases for Cookie
38 *
39 * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
40 * @version $Revision: 155418 $
41 */
42 public class TestCookieBase extends TestCase {
43
44 // ------------------------------------------------------------ Constructor
45
46 public TestCookieBase(String name) {
47 super(name);
48 }
49
50 public static Cookie[] cookieParse(
51 final CookieSpec parser,
52 String host,
53 int port,
54 String path,
55 boolean isSecure,
56 Header setHeader)
57 throws MalformedCookieException {
58 Cookie[] cookies = parser.parse(host, port, path, isSecure, setHeader);
59 if (cookies != null) {
60 for (int i = 0; i < cookies.length; i++) {
61 parser.validate(host, port, path, isSecure, cookies[i]);
62 }
63 }
64 return cookies;
65 }
66 }