1 29 30 package org.apache.commons.httpclient.cookie; 31 32 import junit.framework.Test; 33 import junit.framework.TestSuite; 34 35 36 43 public class TestCookiePolicy extends TestCookieBase { 44 45 47 public TestCookiePolicy(String name) { 48 super(name); 49 } 50 51 53 public static Test suite() { 54 return new TestSuite(TestCookiePolicy.class); 55 } 56 57 public void testRegisterNullPolicyId() { 58 try { 59 CookiePolicy.registerCookieSpec(null, null); 60 fail("IllegalArgumentException must have been thrown"); 61 } catch (IllegalArgumentException expected) { 62 } 63 } 64 65 public void testRegisterNullPolicy() { 66 try { 67 CookiePolicy.registerCookieSpec("whatever", null); 68 fail("IllegalArgumentException must have been thrown"); 69 } catch (IllegalArgumentException expected) { 70 } 71 } 72 73 public void testUnregisterNullPolicy() { 74 try { 75 CookiePolicy.unregisterCookieSpec(null); 76 fail("IllegalArgumentException must have been thrown"); 77 } catch (IllegalArgumentException expected) { 78 } 79 } 80 81 public void testGetPolicyNullId() { 82 try { 83 CookiePolicy.getCookieSpec(null); 84 fail("IllegalArgumentException must have been thrown"); 85 } catch (IllegalArgumentException expected) { 86 } 87 } 88 89 public void testRegisterUnregister() { 90 CookiePolicy.registerCookieSpec("whatever", CookieSpecBase.class); 91 CookiePolicy.unregisterCookieSpec("whatever"); 92 try { 93 CookiePolicy.getCookieSpec("whatever"); 94 fail("IllegalStateException must have been thrown"); 95 } catch (IllegalStateException expected) { 96 } 97 } 98 99 public void testGetDefaultPolicy() { 100 assertNotNull(CookiePolicy.getDefaultSpec()); 101 } 102 } 103 104
| Popular Tags
|