### Question:
CookieHeaderProvider implements HeaderDelegate<Cookie> { public String toString(Cookie c) { StringBuilder sb = new StringBuilder(); if (c.getVersion() != 0) { sb.append(VERSION).append('=').append(c.getVersion()).append(';'); } sb.append(c.getName()).append('=').append(NewCookieHeaderProvider.maybeQuoteAll(c.getValue())); if (c.getPath() != null) { sb.append(';').append(PATH).append('=').append(NewCookieHeaderProvider.maybeQuotePath(c.getPath())); } if (c.getDomain() != null) { sb.append(';').append(DOMAIN).append('=').append(NewCookieHeaderProvider.maybeQuoteAll(c.getDomain())); } return sb.toString(); }  Cookie fromString(String c); String toString(Cookie c);  }### Answer:
@Test public void testToString() { Cookie c = new Cookie("foo", "bar", "path", "domain", 2); assertEquals("$Version=2;foo=bar;$Path=path;$Domain=domain", c.toString()); }
@Test public void testToStringWithQuotes() { Cookie c = new Cookie("foo", "bar z", "path", "domain", 2); assertEquals("$Version=2;foo=\"bar z\";$Path=path;$Domain=domain", c.toString()); }