public void testRemoveCookie() throws Exception {
   man.setThreadContext(jmctx);
   Cookie c = new Cookie("id", "me", "127.0.0.1", "/", false, 0);
   man.add(c);
   assertEquals(1, man.getCookieCount());
   // This should be ignored, as there is no value
   Cookie d = new Cookie("id", "", "127.0.0.1", "/", false, 0);
   man.add(d);
   assertEquals(0, man.getCookieCount());
   man.add(c);
   man.add(c);
   assertEquals(1, man.getCookieCount());
   Cookie e = new Cookie("id", "me2", "127.0.0.1", "/", false, 0);
   man.add(e);
   assertEquals(1, man.getCookieCount());
 }
 public void testSendCookie2() throws Exception {
   man.add(new Cookie("id", "value", ".apache.org", "/", false, 9999999999L));
   HTTPSamplerBase sampler = new HTTPNullSampler();
   sampler.setDomain("jakarta.apache.org");
   sampler.setPath("/index.html");
   sampler.setMethod(HTTPSamplerBase.GET);
   assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
 }
 public void testCookiePolicyIgnore() throws Exception {
   man.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
   man.testStarted(); // ensure policy is picked up
   URL url = new URL("http://order.now/sub1/moo.html");
   man.addCookieFromHeader("test1=moo1;", url);
   man.addCookieFromHeader("test2=moo2;path=/sub1", url);
   man.addCookieFromHeader("test2=moo3;path=/", url);
   assertEquals(0, man.getCookieCount()); // Cookies are ignored
   Cookie cc;
   cc = new Cookie("test1", "moo1", null, "/sub1", false, 0, false, false);
   man.add(cc);
   cc = new Cookie("test2", "moo2", null, "/sub1", false, 0, true, false);
   man.add(cc);
   cc = new Cookie("test3", "moo3", null, "/", false, 0, false, false);
   man.add(cc);
   assertEquals(3, man.getCookieCount());
   assertEquals("/sub1", man.get(0).getPath());
   assertEquals("/sub1", man.get(1).getPath());
   assertEquals("/", man.get(2).getPath());
   String s = man.getCookieHeaderForURL(url);
   assertNull(s);
   org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);
   assertEquals(0, c.length); // Cookies again ignored
 }