001: /*
002: * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/cookie/TestCookiePolicy.java,v 1.2 2004/09/14 20:11:32 olegk Exp $
003: * $Revision: 480424 $
004: * $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
005: * ====================================================================
006: *
007: * Licensed to the Apache Software Foundation (ASF) under one or more
008: * contributor license agreements. See the NOTICE file distributed with
009: * this work for additional information regarding copyright ownership.
010: * The ASF licenses this file to You under the Apache License, Version 2.0
011: * (the "License"); you may not use this file except in compliance with
012: * the License. You may obtain a copy of the License at
013: *
014: * http://www.apache.org/licenses/LICENSE-2.0
015: *
016: * Unless required by applicable law or agreed to in writing, software
017: * distributed under the License is distributed on an "AS IS" BASIS,
018: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019: * See the License for the specific language governing permissions and
020: * limitations under the License.
021: * ====================================================================
022: *
023: * This software consists of voluntary contributions made by many
024: * individuals on behalf of the Apache Software Foundation. For more
025: * information on the Apache Software Foundation, please see
026: * <http://www.apache.org/>.
027: *
028: */
029:
030: package org.apache.commons.httpclient.cookie;
031:
032: import junit.framework.Test;
033: import junit.framework.TestSuite;
034:
035: /**
036: * Test cases for Cookie Policy
037: *
038: * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
039: *
040: * @version $Revision: 480424 $
041: */
042: public class TestCookiePolicy extends TestCookieBase {
043:
044: // ------------------------------------------------------------ Constructor
045:
046: public TestCookiePolicy(String name) {
047: super (name);
048: }
049:
050: // ------------------------------------------------------- TestCase Methods
051:
052: public static Test suite() {
053: return new TestSuite(TestCookiePolicy.class);
054: }
055:
056: public void testRegisterNullPolicyId() {
057: try {
058: CookiePolicy.registerCookieSpec(null, null);
059: fail("IllegalArgumentException must have been thrown");
060: } catch (IllegalArgumentException expected) {
061: }
062: }
063:
064: public void testRegisterNullPolicy() {
065: try {
066: CookiePolicy.registerCookieSpec("whatever", null);
067: fail("IllegalArgumentException must have been thrown");
068: } catch (IllegalArgumentException expected) {
069: }
070: }
071:
072: public void testUnregisterNullPolicy() {
073: try {
074: CookiePolicy.unregisterCookieSpec(null);
075: fail("IllegalArgumentException must have been thrown");
076: } catch (IllegalArgumentException expected) {
077: }
078: }
079:
080: public void testGetPolicyNullId() {
081: try {
082: CookiePolicy.getCookieSpec(null);
083: fail("IllegalArgumentException must have been thrown");
084: } catch (IllegalArgumentException expected) {
085: }
086: }
087:
088: public void testRegisterUnregister() {
089: CookiePolicy.registerCookieSpec("whatever",
090: CookieSpecBase.class);
091: CookiePolicy.unregisterCookieSpec("whatever");
092: try {
093: CookiePolicy.getCookieSpec("whatever");
094: fail("IllegalStateException must have been thrown");
095: } catch (IllegalStateException expected) {
096: }
097: }
098:
099: public void testGetDefaultPolicy() {
100: assertNotNull(CookiePolicy.getDefaultSpec());
101: }
102: }
|