Code example for CookieStore

Methods: add, getCookies, getURIs, removeAll

0
     * @since 1.6 
     */ 
    public void test_removeAll() throws URISyntaxException { 
        // Spec says returns true if this store changed as a result of the call. 
        // But RI always return true. 
        assertTrue(cookieStore.removeAll());
 
        URI uri1 = new URI("http://removeAll1.test.com");
        HttpCookie cookie1 = new HttpCookie("cookie_name1", "cookie_value1");
        cookieStore.add(uri1, cookie1);
        URI uri2 = new URI("http://removeAll2.test.com");
        HttpCookie cookie2 = new HttpCookie("cookie_name2", "cookie_value2");
        cookieStore.add(uri2, cookie2);
 
        assertTrue(cookieStore.removeAll());
        assertTrue(cookieStore.getURIs().isEmpty());
        assertTrue(cookieStore.getCookies().isEmpty());
 
        assertTrue(cookieStore.removeAll());
    } 
 
    @Override 
    protected void setUp() throws Exception { 
        super.setUp();