hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r938585 [6/8] - in /httpcomponents/httpclient/trunk: ./ httpclient/src/test/java/org/apache/http/auth/ httpclient/src/test/java/org/apache/http/client/methods/ httpclient/src/test/java/org/apache/http/client/protocol/ httpclient/src/test/ja...
Date Tue, 27 Apr 2010 18:01:50 GMT
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java?rev=938585&r1=938584&r2=938585&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBasicCookieAttribHandlers.java Tue Apr 27 18:01:48 2010
@@ -33,10 +33,6 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.Locale;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.http.cookie.CookieAttributeHandler;
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.MalformedCookieException;
@@ -50,47 +46,34 @@ import org.apache.http.impl.cookie.Basic
 import org.apache.http.impl.cookie.DateUtils;
 import org.apache.http.impl.cookie.PublicSuffixFilter;
 import org.apache.http.impl.cookie.RFC2109DomainHandler;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class TestBasicCookieAttribHandlers extends TestCase {
-
-    public TestBasicCookieAttribHandlers(String testName) {
-        super(testName);
-    }
-
-    public static Test suite() {
-        return new TestSuite(TestBasicCookieAttribHandlers.class);
-    }
-
-    // ------------------------------------------------------------------- Main
-    public static void main(String args[]) {
-        String[] testCaseName = { TestBasicCookieAttribHandlers.class.getName() };
-        junit.textui.TestRunner.main(testCaseName);
-    }
+public class TestBasicCookieAttribHandlers {
 
+    @Test
     public void testBasicDomainParse() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicDomainHandler();
         h.parse(cookie, "www.somedomain.com");
-        assertEquals("www.somedomain.com", cookie.getDomain());
+        Assert.assertEquals("www.somedomain.com", cookie.getDomain());
     }
 
-    public void testBasicDomainParseInvalid() throws Exception {
+    @Test(expected=MalformedCookieException.class)
+    public void testBasicDomainParseInvalid1() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicDomainHandler();
-        try {
-            h.parse(cookie, "");
-            fail("MalformedCookieException should have been thrown");
-        } catch (MalformedCookieException ex) {
-            // expected
-        }
-        try {
-            h.parse(cookie, null);
-            fail("MalformedCookieException should have been thrown");
-        } catch (MalformedCookieException ex) {
-            // expected
-        }
+        h.parse(cookie, "");
+    }
+
+    @Test(expected=MalformedCookieException.class)
+    public void testBasicDomainParseInvalid2() throws Exception {
+        BasicClientCookie cookie = new BasicClientCookie("name", "value");
+        CookieAttributeHandler h = new BasicDomainHandler();
+        h.parse(cookie, null);
     }
 
+    @Test
     public void testBasicDomainValidate1() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
@@ -102,19 +85,20 @@ public class TestBasicCookieAttribHandle
         cookie.setDomain(".otherdomain.com");
         try {
             h.validate(cookie, origin);
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
         cookie.setDomain("www.otherdomain.com");
         try {
             h.validate(cookie, origin);
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicDomainValidate2() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/", false);
@@ -126,12 +110,13 @@ public class TestBasicCookieAttribHandle
         cookie.setDomain("otherhost");
         try {
             h.validate(cookie, origin);
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicDomainValidate3() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
@@ -141,6 +126,7 @@ public class TestBasicCookieAttribHandle
         h.validate(cookie, origin);
     }
 
+    @Test
     public void testBasicDomainValidate4() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
@@ -149,139 +135,151 @@ public class TestBasicCookieAttribHandle
         cookie.setDomain(null);
         try {
             h.validate(cookie, origin);
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicDomainMatch1() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somedomain.com", 80, "/", false);
         CookieAttributeHandler h = new BasicDomainHandler();
 
         cookie.setDomain("somedomain.com");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
 
         cookie.setDomain(".somedomain.com");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicDomainMatch2() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("www.somedomain.com", 80, "/", false);
         CookieAttributeHandler h = new BasicDomainHandler();
 
         cookie.setDomain("somedomain.com");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
 
         cookie.setDomain(".somedomain.com");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
 
         cookie.setDomain(null);
-        assertFalse(h.match(cookie, origin));
+        Assert.assertFalse(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicDomainInvalidInput() throws Exception {
         CookieAttributeHandler h = new BasicDomainHandler();
         try {
             h.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.validate(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.validate(new BasicClientCookie("name", "value"), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.match(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.match(new BasicClientCookie("name", "value"), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicPathParse() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicPathHandler();
         h.parse(cookie, "stuff");
-        assertEquals("stuff", cookie.getPath());
+        Assert.assertEquals("stuff", cookie.getPath());
         h.parse(cookie, "");
-        assertEquals("/", cookie.getPath());
+        Assert.assertEquals("/", cookie.getPath());
         h.parse(cookie, null);
-        assertEquals("/", cookie.getPath());
+        Assert.assertEquals("/", cookie.getPath());
     }
 
+    @Test
     public void testBasicPathMatch1() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
         CookieAttributeHandler h = new BasicPathHandler();
         cookie.setPath("/stuff");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathMatch2() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/", false);
         CookieAttributeHandler h = new BasicPathHandler();
         cookie.setPath("/stuff");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathMatch3() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/more-stuff", false);
         CookieAttributeHandler h = new BasicPathHandler();
         cookie.setPath("/stuff");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathMatch4() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuffed", false);
         CookieAttributeHandler h = new BasicPathHandler();
         cookie.setPath("/stuff");
-        assertFalse(h.match(cookie, origin));
+        Assert.assertFalse(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathMatch5() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/otherstuff", false);
         CookieAttributeHandler h = new BasicPathHandler();
         cookie.setPath("/stuff");
-        assertFalse(h.match(cookie, origin));
+        Assert.assertFalse(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathMatch6() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
         CookieAttributeHandler h = new BasicPathHandler();
         cookie.setPath("/stuff/");
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathMatch7() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
         CookieAttributeHandler h = new BasicPathHandler();
-        assertTrue(h.match(cookie, origin));
+        Assert.assertTrue(h.match(cookie, origin));
     }
 
+    @Test
     public void testBasicPathValidate() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
@@ -291,135 +289,145 @@ public class TestBasicCookieAttribHandle
         cookie.setPath("/stuffed");
         try {
             h.validate(cookie, origin);
-            fail("MalformedCookieException must have been thrown");
+            Assert.fail("MalformedCookieException must have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicPathInvalidInput() throws Exception {
         CookieAttributeHandler h = new BasicPathHandler();
         try {
             h.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.match(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.match(new BasicClientCookie("name", "value"), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicMaxAgeParse() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicMaxAgeHandler();
         h.parse(cookie, "2000");
-        assertNotNull(cookie.getExpiryDate());
+        Assert.assertNotNull(cookie.getExpiryDate());
     }
 
+    @Test
     public void testBasicMaxAgeParseInvalid() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicMaxAgeHandler();
         try {
             h.parse(cookie, "garbage");
-            fail("MalformedCookieException must have been thrown");
+            Assert.fail("MalformedCookieException must have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
         try {
             h.parse(cookie, null);
-            fail("MalformedCookieException must have been thrown");
+            Assert.fail("MalformedCookieException must have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicMaxAgeInvalidInput() throws Exception {
         CookieAttributeHandler h = new BasicMaxAgeHandler();
         try {
             h.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicCommentParse() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicCommentHandler();
         h.parse(cookie, "whatever");
-        assertEquals("whatever", cookie.getComment());
+        Assert.assertEquals("whatever", cookie.getComment());
         h.parse(cookie, null);
-        assertEquals(null, cookie.getComment());
+        Assert.assertEquals(null, cookie.getComment());
     }
 
+    @Test
     public void testBasicCommentInvalidInput() throws Exception {
         CookieAttributeHandler h = new BasicCommentHandler();
         try {
             h.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicSecureParse() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicSecureHandler();
         h.parse(cookie, "whatever");
-        assertTrue(cookie.isSecure());
+        Assert.assertTrue(cookie.isSecure());
         h.parse(cookie, null);
-        assertTrue(cookie.isSecure());
+        Assert.assertTrue(cookie.isSecure());
     }
 
+    @Test
     public void testBasicSecureMatch() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicSecureHandler();
 
         CookieOrigin origin1 = new CookieOrigin("somehost", 80, "/stuff", false);
         cookie.setSecure(false);
-        assertTrue(h.match(cookie, origin1));
+        Assert.assertTrue(h.match(cookie, origin1));
         cookie.setSecure(true);
-        assertFalse(h.match(cookie, origin1));
+        Assert.assertFalse(h.match(cookie, origin1));
 
         CookieOrigin origin2 = new CookieOrigin("somehost", 80, "/stuff", true);
         cookie.setSecure(false);
-        assertTrue(h.match(cookie, origin2));
+        Assert.assertTrue(h.match(cookie, origin2));
         cookie.setSecure(true);
-        assertTrue(h.match(cookie, origin2));
+        Assert.assertTrue(h.match(cookie, origin2));
     }
 
+    @Test
     public void testBasicSecureInvalidInput() throws Exception {
         CookieAttributeHandler h = new BasicSecureHandler();
         try {
             h.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.match(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             h.match(new BasicClientCookie("name", "value"), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicExpiresParse() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123});
@@ -430,42 +438,45 @@ public class TestBasicCookieAttribHandle
         Date now = new Date();
 
         h.parse(cookie, dateformat.format(now));
-        assertNotNull(cookie.getExpiryDate());
+        Assert.assertNotNull(cookie.getExpiryDate());
     }
 
+    @Test
     public void testBasicExpiresParseInvalid() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123});
         try {
             h.parse(cookie, "garbage");
-            fail("MalformedCookieException must have been thrown");
+            Assert.fail("MalformedCookieException must have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
         try {
             h.parse(cookie, null);
-            fail("MalformedCookieException must have been thrown");
+            Assert.fail("MalformedCookieException must have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testBasicExpiresInvalidInput() throws Exception {
         try {
             new BasicExpiresHandler(null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123});
         try {
             h.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testPublicSuffixFilter() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
 
@@ -473,19 +484,19 @@ public class TestBasicCookieAttribHandle
         h.setPublicSuffixes(Arrays.asList(new String[] { "co.uk", "com" }));
 
         cookie.setDomain(".co.uk");
-        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
+        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
 
         cookie.setDomain("co.uk");
-        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
+        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
 
         cookie.setDomain(".com");
-        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
+        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
 
         cookie.setDomain("com");
-        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
+        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
 
         cookie.setDomain("localhost");
-        assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));
+        Assert.assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java?rev=938585&r1=938584&r2=938585&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestBrowserCompatSpec.java Tue Apr 27 18:01:48 2010
@@ -31,10 +31,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.http.Header;
 import org.apache.http.cookie.ClientCookie;
 import org.apache.http.cookie.Cookie;
@@ -42,26 +38,16 @@ import org.apache.http.cookie.CookieOrig
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.message.BasicHeader;
-
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for BrowserCompatSpec
  *
  */
-public class TestBrowserCompatSpec extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-
-    public TestBrowserCompatSpec(String name) {
-        super(name);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
-
-    public static Test suite() {
-        return new TestSuite(TestBrowserCompatSpec.class);
-    }
+public class TestBrowserCompatSpec {
 
+    @Test
     public void testConstructor() throws Exception {
         new BrowserCompatSpec();
         new BrowserCompatSpec(null);
@@ -71,6 +57,7 @@ public class TestBrowserCompatSpec exten
     /**
      * Tests whether domain attribute check is case-insensitive.
      */
+    @Test
     public void testDomainCaseInsensitivity() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "name=value; path=/; domain=.whatever.com");
@@ -81,14 +68,15 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertNotNull(cookies);
-        assertEquals(1, cookies.size());
-        assertEquals(".whatever.com", cookies.get(0).getDomain());
+        Assert.assertNotNull(cookies);
+        Assert.assertEquals(1, cookies.size());
+        Assert.assertEquals(".whatever.com", cookies.get(0).getDomain());
     }
 
     /**
      * Test basic parse (with various spacings
      */
+    @Test
     public void testParse1() throws Exception {
         String headerValue = "custno = 12345; comment=test; version=1," +
             " name=John; version=1; max-age=600; secure; domain=.apache.org";
@@ -101,28 +89,29 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals(2, cookies.size());
+        Assert.assertEquals(2, cookies.size());
 
-        assertEquals("custno", cookies.get(0).getName());
-        assertEquals("12345", cookies.get(0).getValue());
-        assertEquals("test", cookies.get(0).getComment());
-        assertEquals(0, cookies.get(0).getVersion());
-        assertEquals("www.apache.org", cookies.get(0).getDomain());
-        assertEquals("/", cookies.get(0).getPath());
-        assertFalse(cookies.get(0).isSecure());
-
-        assertEquals("name", cookies.get(1).getName());
-        assertEquals("John", cookies.get(1).getValue());
-        assertEquals(null, cookies.get(1).getComment());
-        assertEquals(0, cookies.get(1).getVersion());
-        assertEquals(".apache.org", cookies.get(1).getDomain());
-        assertEquals("/", cookies.get(1).getPath());
-        assertTrue(cookies.get(1).isSecure());
+        Assert.assertEquals("custno", cookies.get(0).getName());
+        Assert.assertEquals("12345", cookies.get(0).getValue());
+        Assert.assertEquals("test", cookies.get(0).getComment());
+        Assert.assertEquals(0, cookies.get(0).getVersion());
+        Assert.assertEquals("www.apache.org", cookies.get(0).getDomain());
+        Assert.assertEquals("/", cookies.get(0).getPath());
+        Assert.assertFalse(cookies.get(0).isSecure());
+
+        Assert.assertEquals("name", cookies.get(1).getName());
+        Assert.assertEquals("John", cookies.get(1).getValue());
+        Assert.assertEquals(null, cookies.get(1).getComment());
+        Assert.assertEquals(0, cookies.get(1).getVersion());
+        Assert.assertEquals(".apache.org", cookies.get(1).getDomain());
+        Assert.assertEquals("/", cookies.get(1).getPath());
+        Assert.assertTrue(cookies.get(1).isSecure());
     }
 
     /**
      * Test no spaces
      */
+    @Test
     public void testParse2() throws Exception {
         String headerValue = "custno=12345;comment=test; version=1," +
             "name=John;version=1;max-age=600;secure;domain=.apache.org";
@@ -136,29 +125,30 @@ public class TestBrowserCompatSpec exten
             cookiespec.validate(cookies.get(i), origin);
         }
 
-        assertEquals(2, cookies.size());
+        Assert.assertEquals(2, cookies.size());
 
-        assertEquals("custno", cookies.get(0).getName());
-        assertEquals("12345", cookies.get(0).getValue());
-        assertEquals("test", cookies.get(0).getComment());
-        assertEquals(0, cookies.get(0).getVersion());
-        assertEquals("www.apache.org", cookies.get(0).getDomain());
-        assertEquals("/", cookies.get(0).getPath());
-        assertFalse(cookies.get(0).isSecure());
-
-        assertEquals("name", cookies.get(1).getName());
-        assertEquals("John", cookies.get(1).getValue());
-        assertEquals(null, cookies.get(1).getComment());
-        assertEquals(0, cookies.get(1).getVersion());
-        assertEquals(".apache.org", cookies.get(1).getDomain());
-        assertEquals("/", cookies.get(1).getPath());
-        assertTrue(cookies.get(1).isSecure());
+        Assert.assertEquals("custno", cookies.get(0).getName());
+        Assert.assertEquals("12345", cookies.get(0).getValue());
+        Assert.assertEquals("test", cookies.get(0).getComment());
+        Assert.assertEquals(0, cookies.get(0).getVersion());
+        Assert.assertEquals("www.apache.org", cookies.get(0).getDomain());
+        Assert.assertEquals("/", cookies.get(0).getPath());
+        Assert.assertFalse(cookies.get(0).isSecure());
+
+        Assert.assertEquals("name", cookies.get(1).getName());
+        Assert.assertEquals("John", cookies.get(1).getValue());
+        Assert.assertEquals(null, cookies.get(1).getComment());
+        Assert.assertEquals(0, cookies.get(1).getVersion());
+        Assert.assertEquals(".apache.org", cookies.get(1).getDomain());
+        Assert.assertEquals("/", cookies.get(1).getPath());
+        Assert.assertTrue(cookies.get(1).isSecure());
     }
 
 
     /**
      * Test parse with quoted text
      */
+    @Test
     public void testParse3() throws Exception {
         String headerValue =
             "name=\"Doe, John\";version=1;max-age=600;secure;domain=.apache.org";
@@ -171,19 +161,20 @@ public class TestBrowserCompatSpec exten
             cookiespec.validate(cookies.get(i), origin);
         }
 
-        assertEquals(1, cookies.size());
+        Assert.assertEquals(1, cookies.size());
 
-        assertEquals("name", cookies.get(0).getName());
-        assertEquals("Doe, John", cookies.get(0).getValue());
-        assertEquals(null, cookies.get(0).getComment());
-        assertEquals(0, cookies.get(0).getVersion());
-        assertEquals(".apache.org", cookies.get(0).getDomain());
-        assertEquals("/", cookies.get(0).getPath());
-        assertTrue(cookies.get(0).isSecure());
+        Assert.assertEquals("name", cookies.get(0).getName());
+        Assert.assertEquals("Doe, John", cookies.get(0).getValue());
+        Assert.assertEquals(null, cookies.get(0).getComment());
+        Assert.assertEquals(0, cookies.get(0).getVersion());
+        Assert.assertEquals(".apache.org", cookies.get(0).getDomain());
+        Assert.assertEquals("/", cookies.get(0).getPath());
+        Assert.assertTrue(cookies.get(0).isSecure());
     }
 
 
     // see issue #5279
+    @Test
     public void testQuotedExpiresAttribute() throws Exception {
         String headerValue = "custno=12345;Expires='Thu, 01-Jan-2070 00:00:10 GMT'";
 
@@ -195,11 +186,12 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertNotNull("Expected some cookies",cookies);
-        assertEquals("Expected 1 cookie",1,cookies.size());
-        assertNotNull("Expected cookie to have getExpiryDate",cookies.get(0).getExpiryDate());
+        Assert.assertNotNull("Expected some cookies",cookies);
+        Assert.assertEquals("Expected 1 cookie",1,cookies.size());
+        Assert.assertNotNull("Expected cookie to have getExpiryDate",cookies.get(0).getExpiryDate());
     }
 
+    @Test
     public void testSecurityError() throws Exception {
         String headerValue = "custno=12345;comment=test; version=1," +
             "name=John;version=1;max-age=600;secure;domain=jakarta.apache.org";
@@ -212,12 +204,13 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException exception should have been thrown");
+            Assert.fail("MalformedCookieException exception should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testParseSimple() throws Exception {
         Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value");
 
@@ -227,19 +220,20 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertTrue("Comment",null == cookies.get(0).getComment());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        //assertTrue("isToBeDiscarded",cookies.get(0).isToBeDiscarded());
-        assertTrue("isPersistent",!cookies.get(0).isPersistent());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/path",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertEquals("Version",0,cookies.get(0).getVersion());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        //Assert.assertTrue("isToBeDiscarded",cookies.get(0).isToBeDiscarded());
+        Assert.assertTrue("isPersistent",!cookies.get(0).isPersistent());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/path",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertEquals("Version",0,cookies.get(0).getVersion());
     }
 
+    @Test
     public void testParseSimple2() throws Exception {
         Header header = new BasicHeader("Set-Cookie", "cookie-name=cookie-value");
 
@@ -249,19 +243,20 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.", 1, cookies.size());
-        assertEquals("Name", "cookie-name", cookies.get(0).getName());
-        assertEquals("Value", "cookie-value", cookies.get(0).getValue());
-        assertTrue("Comment", null == cookies.get(0).getComment());
-        assertTrue("ExpiryDate", null == cookies.get(0).getExpiryDate());
-        //assertTrue("isToBeDiscarded",cookies.get(0).isToBeDiscarded());
-        assertTrue("isPersistent", !cookies.get(0).isPersistent());
-        assertEquals("Domain", "127.0.0.1", cookies.get(0).getDomain());
-        assertEquals("Path", "/", cookies.get(0).getPath());
-        assertTrue("Secure", !cookies.get(0).isSecure());
-        assertEquals("Version", 0, cookies.get(0).getVersion());
+        Assert.assertEquals("Found 1 cookie.", 1, cookies.size());
+        Assert.assertEquals("Name", "cookie-name", cookies.get(0).getName());
+        Assert.assertEquals("Value", "cookie-value", cookies.get(0).getValue());
+        Assert.assertTrue("Comment", null == cookies.get(0).getComment());
+        Assert.assertTrue("ExpiryDate", null == cookies.get(0).getExpiryDate());
+        //Assert.assertTrue("isToBeDiscarded",cookies.get(0).isToBeDiscarded());
+        Assert.assertTrue("isPersistent", !cookies.get(0).isPersistent());
+        Assert.assertEquals("Domain", "127.0.0.1", cookies.get(0).getDomain());
+        Assert.assertEquals("Path", "/", cookies.get(0).getPath());
+        Assert.assertTrue("Secure", !cookies.get(0).isSecure());
+        Assert.assertEquals("Version", 0, cookies.get(0).getVersion());
     }
 
+    @Test
     public void testParseNoName() throws Exception {
         Header header = new BasicHeader("Set-Cookie","=stuff; path=/");
 
@@ -272,12 +267,13 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testParseNoValue() throws Exception {
         Header header = new BasicHeader("Set-Cookie","cookie-name=");
 
@@ -287,19 +283,20 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value", "", cookies.get(0).getValue());
-        assertTrue("Comment",null == cookies.get(0).getComment());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        //assertTrue("isToBeDiscarded",cookies.get(0).isToBeDiscarded());
-        assertTrue("isPersistent",!cookies.get(0).isPersistent());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertEquals("Version",0,cookies.get(0).getVersion());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value", "", cookies.get(0).getValue());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        //Assert.assertTrue("isToBeDiscarded",cookies.get(0).isToBeDiscarded());
+        Assert.assertTrue("isPersistent",!cookies.get(0).isPersistent());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertEquals("Version",0,cookies.get(0).getVersion());
     }
 
+    @Test
     public void testParseWithWhiteSpace() throws Exception {
         Header header = new BasicHeader("Set-Cookie"," cookie-name  =    cookie-value  ");
 
@@ -309,16 +306,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithQuotes() throws Exception {
         Header header = new BasicHeader("Set-Cookie"," cookie-name  =  \" cookie-value \" ;path=/");
 
@@ -328,16 +326,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value"," cookie-value ",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value"," cookie-value ",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithPath() throws Exception {
         Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; Path=/path/");
 
@@ -347,16 +346,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/path/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/path/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithDomain() throws Exception {
         Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; Domain=127.0.0.1");
 
@@ -366,16 +366,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithSecure() throws Exception {
         Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; secure");
 
@@ -385,16 +386,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",cookies.get(0).isSecure());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",cookies.get(0).isSecure());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithComment() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; comment=\"This is a comment.\"");
@@ -405,16 +407,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
-        assertEquals("Comment","This is a comment.",cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertTrue("ExpiryDate",null == cookies.get(0).getExpiryDate());
+        Assert.assertEquals("Comment","This is a comment.",cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithExpires() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value;Expires=Thu, 01-Jan-1970 00:00:10 GMT");
@@ -425,16 +428,17 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
-        assertEquals("Path","/",cookies.get(0).getPath());
-        assertTrue("Secure",!cookies.get(0).isSecure());
-        assertEquals(new Date(10000L),cookies.get(0).getExpiryDate());
-        assertTrue("Comment",null == cookies.get(0).getComment());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain","127.0.0.1",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",!cookies.get(0).isSecure());
+        Assert.assertEquals(new Date(10000L),cookies.get(0).getExpiryDate());
+        Assert.assertTrue("Comment",null == cookies.get(0).getComment());
     }
 
+    @Test
     public void testParseWithAll() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value;Version=1;Path=/commons;Domain=.apache.org;" +
@@ -446,17 +450,18 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookie.",1,cookies.size());
-        assertEquals("Name","cookie-name",cookies.get(0).getName());
-        assertEquals("Value","cookie-value",cookies.get(0).getValue());
-        assertEquals("Domain",".apache.org",cookies.get(0).getDomain());
-        assertEquals("Path","/commons",cookies.get(0).getPath());
-        assertTrue("Secure",cookies.get(0).isSecure());
-        assertEquals(new Date(10000L),cookies.get(0).getExpiryDate());
-        assertEquals("Comment","This is a comment.",cookies.get(0).getComment());
-        assertEquals("Version",0,cookies.get(0).getVersion());
+        Assert.assertEquals("Found 1 cookie.",1,cookies.size());
+        Assert.assertEquals("Name","cookie-name",cookies.get(0).getName());
+        Assert.assertEquals("Value","cookie-value",cookies.get(0).getValue());
+        Assert.assertEquals("Domain",".apache.org",cookies.get(0).getDomain());
+        Assert.assertEquals("Path","/commons",cookies.get(0).getPath());
+        Assert.assertTrue("Secure",cookies.get(0).isSecure());
+        Assert.assertEquals(new Date(10000L),cookies.get(0).getExpiryDate());
+        Assert.assertEquals("Comment","This is a comment.",cookies.get(0).getComment());
+        Assert.assertEquals("Version",0,cookies.get(0).getVersion());
     }
 
+    @Test
     public void testParseMultipleDifferentPaths() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "name1=value1;Version=1;Path=/commons,name1=value2;Version=1;" +
@@ -468,13 +473,14 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Wrong number of cookies.",2,cookies.size());
-        assertEquals("Name","name1",cookies.get(0).getName());
-        assertEquals("Value","value1",cookies.get(0).getValue());
-        assertEquals("Name","name1",cookies.get(1).getName());
-        assertEquals("Value","value2",cookies.get(1).getValue());
+        Assert.assertEquals("Wrong number of cookies.",2,cookies.size());
+        Assert.assertEquals("Name","name1",cookies.get(0).getName());
+        Assert.assertEquals("Value","value1",cookies.get(0).getValue());
+        Assert.assertEquals("Name","name1",cookies.get(1).getName());
+        Assert.assertEquals("Value","value2",cookies.get(1).getValue());
     }
 
+    @Test
     public void testParseRelativePath() throws Exception {
         Header header = new BasicHeader("Set-Cookie", "name1=value1;Path=whatever");
 
@@ -484,12 +490,13 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertEquals("Found 1 cookies.",1,cookies.size());
-        assertEquals("Name","name1",cookies.get(0).getName());
-        assertEquals("Value","value1",cookies.get(0).getValue());
-        assertEquals("Path","whatever",cookies.get(0).getPath());
+        Assert.assertEquals("Found 1 cookies.",1,cookies.size());
+        Assert.assertEquals("Name","name1",cookies.get(0).getName());
+        Assert.assertEquals("Value","value1",cookies.get(0).getValue());
+        Assert.assertEquals("Path","whatever",cookies.get(0).getPath());
     }
 
+    @Test
     public void testParseWithWrongDomain() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=127.0.0.1; version=1");
@@ -501,12 +508,13 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException exception should have been thrown");
+            Assert.fail("MalformedCookieException exception should have been thrown");
         } catch (MalformedCookieException ex) {
             // expected
         }
     }
 
+    @Test
     public void testParseWithPathMismatch() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; path=/path/path/path");
@@ -518,12 +526,13 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException should have been thrown.");
+            Assert.fail("MalformedCookieException should have been thrown.");
         } catch (MalformedCookieException e) {
             // expected
         }
     }
 
+    @Test
     public void testParseWithPathMismatch2() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; path=/foobar");
@@ -535,7 +544,7 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException should have been thrown.");
+            Assert.fail("MalformedCookieException should have been thrown.");
         } catch (MalformedCookieException e) {
             // expected
         }
@@ -544,6 +553,7 @@ public class TestBrowserCompatSpec exten
     /**
      * Tests if cookie constructor rejects cookie name containing blanks.
      */
+    @Test
     public void testCookieNameWithBlanks() throws Exception {
         Header header = new BasicHeader("Set-Cookie", "invalid name=");
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -552,13 +562,14 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertNotNull(cookies);
-        assertEquals(1, cookies.size());
+        Assert.assertNotNull(cookies);
+        Assert.assertEquals(1, cookies.size());
     }
 
     /**
      * Tests if cookie constructor rejects cookie name containing blanks.
      */
+    @Test
     public void testCookieNameBlank() throws Exception {
         Header header = new BasicHeader("Set-Cookie", "=stuff");
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -568,7 +579,7 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException expected) {
         }
     }
@@ -576,6 +587,7 @@ public class TestBrowserCompatSpec exten
     /**
      * Tests if cookie constructor rejects cookie name starting with $.
      */
+    @Test
     public void testCookieNameStartingWithDollarSign() throws Exception {
         Header header = new BasicHeader("Set-Cookie", "$invalid_name=");
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -584,14 +596,15 @@ public class TestBrowserCompatSpec exten
         for (int i = 0; i < cookies.size(); i++) {
             cookiespec.validate(cookies.get(i), origin);
         }
-        assertNotNull(cookies);
-        assertEquals(1, cookies.size());
+        Assert.assertNotNull(cookies);
+        Assert.assertEquals(1, cookies.size());
     }
 
 
     /**
      * Tests if malformatted expires attribute is cookies correctly.
      */
+    @Test
     public void testCookieWithComma() throws Exception {
         Header header = new BasicHeader("Set-Cookie", "name=value; expires=\"Thu, 01-Jan-1970 00:00:00 GMT");
 
@@ -602,7 +615,7 @@ public class TestBrowserCompatSpec exten
             for (int i = 0; i < cookies.size(); i++) {
                 cookiespec.validate(cookies.get(i), origin);
             }
-            fail("MalformedCookieException should have been thrown");
+            Assert.fail("MalformedCookieException should have been thrown");
         } catch (MalformedCookieException expected) {
         }
     }
@@ -611,6 +624,7 @@ public class TestBrowserCompatSpec exten
     /**
      * Tests several date formats.
      */
+    @Test
     public void testDateFormats() throws Exception {
         //comma, dashes
         checkDate("Thu, 01-Jan-70 00:00:10 GMT");
@@ -630,9 +644,8 @@ public class TestBrowserCompatSpec exten
 
         try {
             checkDate("this aint a date");
-            fail("Date check is bogous");
+            Assert.fail("Date check is bogus");
         } catch(Exception e) {
-            /* must fail */
         }
     }
 
@@ -650,6 +663,7 @@ public class TestBrowserCompatSpec exten
      * Tests if invalid second domain level cookie gets accepted in the
      * browser compatibility mode.
      */
+    @Test
     public void testSecondDomainLevelCookie() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain(".sourceforge.net");
@@ -662,6 +676,7 @@ public class TestBrowserCompatSpec exten
         cookiespec.validate(cookie, origin);
     }
 
+    @Test
     public void testSecondDomainLevelCookieMatch1() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain(".sourceforge.net");
@@ -671,9 +686,10 @@ public class TestBrowserCompatSpec exten
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("sourceforge.net", 80, "/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testSecondDomainLevelCookieMatch2() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain("sourceforge.net");
@@ -683,9 +699,10 @@ public class TestBrowserCompatSpec exten
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.sourceforge.net", 80, "/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testSecondDomainLevelCookieMatch3() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain(".sourceforge.net");
@@ -695,9 +712,10 @@ public class TestBrowserCompatSpec exten
 
          CookieSpec cookiespec = new BrowserCompatSpec();
          CookieOrigin origin = new CookieOrigin("www.sourceforge.net", 80, "/", false);
-         assertTrue(cookiespec.match(cookie, origin));
+         Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testInvalidSecondDomainLevelCookieMatch1() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain(".sourceforge.net");
@@ -707,9 +725,10 @@ public class TestBrowserCompatSpec exten
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("antisourceforge.net", 80, "/", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testInvalidSecondDomainLevelCookieMatch2() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain("sourceforge.net");
@@ -719,115 +738,128 @@ public class TestBrowserCompatSpec exten
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("antisourceforge.net", 80, "/", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testMatchBlankPath() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin("host", 80, "  ", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testMatchNullCookieDomain() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testMatchNullCookiePath() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMatch1() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin("host", 80, "/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMatch2() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain(".whatever.com");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin(".whatever.com", 80, "/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMatch3() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain(".whatever.com");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin(".really.whatever.com", 80, "/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMatch4() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin("host", 80, "/foobar", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMismatch1() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host1");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin("host2", 80, "/", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMismatch2() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain(".aaaaaaaaa.com");
         cookie.setPath("/");
         CookieOrigin origin = new CookieOrigin(".bbbbbbbb.com", 80, "/", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMismatch3() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         cookie.setPath("/foobar");
         CookieOrigin origin = new CookieOrigin("host", 80, "/foo", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMismatch4() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         cookie.setPath("/foobar");
         CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMatch5() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
         cookie.setDomain("host");
         cookie.setPath("/foobar/r");
         CookieOrigin origin = new CookieOrigin("host", 80, "/foobar/", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieMismatch6() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         BasicClientCookie cookie = new BasicClientCookie("name", "value");
@@ -835,9 +867,10 @@ public class TestBrowserCompatSpec exten
         cookie.setPath("/foobar");
         cookie.setSecure(true);
         CookieOrigin origin = new CookieOrigin("host", 80, "/foobar", false);
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testInvalidMatchDomain() throws Exception {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain("beta.gamma.com");
@@ -848,12 +881,13 @@ public class TestBrowserCompatSpec exten
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("alpha.beta.gamma.com", 80, "/", false);
         cookiespec.validate(cookie, origin);
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
     /**
      * Tests generic cookie formatting.
      */
+    @Test
     public void testGenericCookieFormatting() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "name=value; path=/; domain=.mydomain.com");
@@ -862,14 +896,15 @@ public class TestBrowserCompatSpec exten
         List<Cookie> cookies = cookiespec.parse(header, origin);
         cookiespec.validate(cookies.get(0), origin);
         List<Header> headers = cookiespec.formatCookies(cookies);
-        assertNotNull(headers);
-        assertEquals(1, headers.size());
-        assertEquals("name=value", headers.get(0).getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.size());
+        Assert.assertEquals("name=value", headers.get(0).getValue());
     }
 
     /**
      * Tests if null cookie values are handled correctly.
      */
+    @Test
     public void testNullCookieValueFormatting() {
         BasicClientCookie cookie = new BasicClientCookie("name", null);
         cookie.setDomain(".whatever.com");
@@ -881,14 +916,15 @@ public class TestBrowserCompatSpec exten
         List<Cookie> cookies = new ArrayList<Cookie>(1);
         cookies.add(cookie);
         List<Header> headers = cookiespec.formatCookies(cookies);
-        assertNotNull(headers);
-        assertEquals(1, headers.size());
-        assertEquals("name=", headers.get(0).getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.size());
+        Assert.assertEquals("name=", headers.get(0).getValue());
     }
 
     /**
      * Tests generic cookie formatting.
      */
+    @Test
     public void testFormatSeveralCookies() throws Exception {
         Header header = new BasicHeader("Set-Cookie",
             "name1=value1; path=/; domain=.mydomain.com, name2 = value2 ; path=/; domain=.mydomain.com");
@@ -896,65 +932,67 @@ public class TestBrowserCompatSpec exten
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
         List<Cookie> cookies = cookiespec.parse(header, origin);
         List<Header> headers = cookiespec.formatCookies(cookies);
-        assertNotNull(headers);
-        assertEquals(1, headers.size());
-        assertEquals("name1=value1; name2=value2", headers.get(0).getValue());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.size());
+        Assert.assertEquals("name1=value1; name2=value2", headers.get(0).getValue());
     }
 
+    @Test
     public void testKeepCloverHappy() throws Exception {
         new MalformedCookieException();
         new MalformedCookieException("whatever");
         new MalformedCookieException("whatever", null);
     }
 
+    @Test
     public void testInvalidInput() throws Exception {
         CookieSpec cookiespec = new BrowserCompatSpec();
         try {
             cookiespec.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.parse(new BasicHeader("Set-Cookie", "name=value"), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.validate(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.validate(new BasicClientCookie("name", null), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.match(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.match(new BasicClientCookie("name", null), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.formatCookies(null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             List<Cookie> cookies = new ArrayList<Cookie>();
             cookiespec.formatCookies(cookies);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java?rev=938585&r1=938584&r2=938585&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java Tue Apr 27 18:01:48 2010
@@ -30,10 +30,6 @@ package org.apache.http.impl.cookie;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.http.Header;
 import org.apache.http.cookie.ClientCookie;
 import org.apache.http.cookie.Cookie;
@@ -42,26 +38,15 @@ import org.apache.http.cookie.CookieSpec
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.cookie.SetCookie2;
 import org.apache.http.message.BasicHeader;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for 'best match' cookie policy
- *
- *
  */
-public class TestCookieBestMatchSpec extends TestCase {
-
-    // ------------------------------------------------------------ Constructor
-
-    public TestCookieBestMatchSpec(String name) {
-        super(name);
-    }
-
-    // ------------------------------------------------------- TestCase Methods
-
-    public static Test suite() {
-        return new TestSuite(TestCookieBestMatchSpec.class);
-    }
+public class TestCookieBestMatchSpec {
 
+    @Test
     public void testCookieBrowserCompatParsing() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("a.b.domain.com", 80, "/", false);
@@ -76,6 +61,7 @@ public class TestCookieBestMatchSpec ext
         }
     }
 
+    @Test
     public void testNetscapeCookieParsing() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
@@ -90,12 +76,13 @@ public class TestCookieBestMatchSpec ext
         try {
             cookies = cookiespec.parse(header, origin);
             cookiespec.validate(cookies.get(0), origin);
-            fail("MalformedCookieException exception should have been thrown");
+            Assert.fail("MalformedCookieException exception should have been thrown");
         } catch (MalformedCookieException e) {
             // expected
         }
     }
 
+    @Test
     public void testCookieStandardCompliantParsing() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("a.b.domain.com", 80, "/", false);
@@ -122,12 +109,13 @@ public class TestCookieBestMatchSpec ext
         try {
             cookies = cookiespec.parse(header, origin);
             cookiespec.validate(cookies.get(0), origin);
-            fail("MalformedCookieException exception should have been thrown");
+            Assert.fail("MalformedCookieException exception should have been thrown");
         } catch (MalformedCookieException e) {
             // expected
         }
     }
 
+    @Test
     public void testCookieStandardCompliantParsingLocalHost() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
@@ -138,11 +126,12 @@ public class TestCookieBestMatchSpec ext
         for (int i = 0; i < cookies.size(); i++) {
             Cookie cookie = cookies.get(i);
             cookiespec.validate(cookie, origin);
-            assertEquals("localhost", cookie.getDomain());
-            assertFalse(cookie instanceof SetCookie2);
+            Assert.assertEquals("localhost", cookie.getDomain());
+            Assert.assertFalse(cookie instanceof SetCookie2);
         }
     }
 
+    @Test
     public void testCookieStandardCompliantParsingLocalHost2() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
@@ -153,11 +142,12 @@ public class TestCookieBestMatchSpec ext
         for (int i = 0; i < cookies.size(); i++) {
             Cookie cookie = cookies.get(i);
             cookiespec.validate(cookie, origin);
-            assertEquals("localhost.local", cookie.getDomain());
-            assertTrue(cookie instanceof SetCookie2);
+            Assert.assertEquals("localhost.local", cookie.getDomain());
+            Assert.assertTrue(cookie instanceof SetCookie2);
         }
     }
 
+    @Test
     public void testCookieBrowserCompatMatch() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("a.b.domain.com", 80, "/", false);
@@ -170,9 +160,10 @@ public class TestCookieBestMatchSpec ext
         cookie.setPath("/");
         cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath());
 
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieStandardCompliantMatch() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         CookieOrigin origin = new CookieOrigin("a.b.domain.com", 80, "/", false);
@@ -186,13 +177,14 @@ public class TestCookieBestMatchSpec ext
         cookie.setPath("/");
         cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath());
 
-        assertFalse(cookiespec.match(cookie, origin));
+        Assert.assertFalse(cookiespec.match(cookie, origin));
 
         cookie.setDomain(".b.domain.com");
 
-        assertTrue(cookiespec.match(cookie, origin));
+        Assert.assertTrue(cookiespec.match(cookie, origin));
     }
 
+    @Test
     public void testCookieBrowserCompatFormatting() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
 
@@ -216,14 +208,15 @@ public class TestCookieBestMatchSpec ext
         cookies.add(cookie2);
 
         List<Header> headers = cookiespec.formatCookies(cookies);
-        assertNotNull(headers);
-        assertEquals(1, headers.size());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.size());
 
         Header header = headers.get(0);
-        assertEquals("name1=value1; name2=value2", header.getValue());
+        Assert.assertEquals("name1=value1; name2=value2", header.getValue());
 
     }
 
+    @Test
     public void testCookieStandardCompliantFormatting() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec(null, true);
 
@@ -248,40 +241,41 @@ public class TestCookieBestMatchSpec ext
         cookies.add(cookie2);
 
         List<Header> headers = cookiespec.formatCookies(cookies);
-        assertNotNull(headers);
-        assertEquals(1, headers.size());
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(1, headers.size());
 
         Header header = headers.get(0);
-        assertEquals("$Version=1; name1=\"value1\"; $Path=\"/\"; $Domain=\".domain.com\"; " +
+        Assert.assertEquals("$Version=1; name1=\"value1\"; $Path=\"/\"; $Domain=\".domain.com\"; " +
                 "name2=\"value2\"; $Path=\"/\"; $Domain=\".domain.com\"",
                 header.getValue());
 
     }
 
+    @Test
     public void testInvalidInput() throws Exception {
         CookieSpec cookiespec = new BestMatchSpec();
         try {
             cookiespec.parse(null, null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.parse(new BasicHeader("Set-Cookie", "name=value"), null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             cookiespec.formatCookies(null);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try {
             List<Cookie> cookies = new ArrayList<Cookie>();
             cookiespec.formatCookies(cookies);
-            fail("IllegalArgumentException must have been thrown");
+            Assert.fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
         }



Mime
View raw message