@Test
public void testCookieDecode() {

    String cookieString = "key1=val1; key2=val2";
    Map<String, String> cookies = CookieJar.decodeCookies(cookieString);
    assertEquals(cookies.get("key1"), "val1");
    assertEquals(cookies.get("key2"), "val2");
    cookieString = "foo=bar";
    cookies = CookieJar.decodeCookies(cookieString);
    assertEquals(cookies.get("foo"), "bar");
    cookieString = "";
    cookies = CookieJar.decodeCookies(cookieString);
    assertEquals(cookies.size(), 0);
    cookieString = ";";
    cookies = CookieJar.decodeCookies(cookieString);
    assertEquals(cookies.size(), 0);
    cookieString = "foo=;foo=bar";
    cookies = CookieJar.decodeCookies(cookieString);
    assertEquals(cookies.size(), 1);
    assertEquals(cookies.get("foo"), "bar");
}