### Question:
NewCookieHeaderProvider implements HeaderDelegate<NewCookie> { @Override public String toString(NewCookie value) { if (null == value) { throw new NullPointerException("Null cookie input"); } StringBuilder sb = new StringBuilder(); sb.append(value.getName()).append('=').append(maybeQuoteAll(value.getValue())); if (value.getComment() != null) { sb.append(';').append(COMMENT).append('=').append(maybeQuoteAll(value.getComment())); } if (value.getDomain() != null) { sb.append(';').append(DOMAIN).append('=').append(maybeQuoteAll(value.getDomain())); } if (value.getMaxAge() != -1) { sb.append(';').append(MAX_AGE).append('=').append(value.getMaxAge()); } if (value.getPath() != null) { sb.append(';').append(PATH).append('=').append(maybeQuotePath(value.getPath())); } if (value.getExpiry() != null) { sb.append(';').append(EXPIRES).append('=').append(HttpUtils.toHttpDate(value.getExpiry())); } if (value.isSecure()) { sb.append(';').append(SECURE); } if (value.isHttpOnly()) { sb.append(';').append(HTTP_ONLY); } sb.append(';').append(VERSION).append('=').append(value.getVersion()); return sb.toString(); }  NewCookie fromString(String c); @Override String toString(NewCookie value);  }### Answer:
@Test public void testToString() { NewCookie c = new NewCookie("foo", "bar", "path", "domain", "comment", 2, true); assertEquals("foo=bar;Comment=comment;Domain=domain;Max-Age=2;Path=path;Secure;Version=1", c.toString()); }
@Test public void testToStringWithSpecialChar() { NewCookie c = new NewCookie("foo", "bar (space)<>[]", "/path?path", "domain.com", "comment@comment:,", 2, true); assertEquals("foo=\"bar (space)<>[]\";Comment=\"comment@comment:,\";Domain=domain.com;Max-Age=2;" + "Path=\"/path?path\";Secure;Version=1", c.toString()); }
@Test public void testToStringWithPathSlalshOnly() { NewCookie c = new NewCookie("foo", "bar (space)<>[]", "/path", "domain.com", "comment@comment:,", 2, true); assertEquals("foo=\"bar (space)<>[]\";Comment=\"comment@comment:,\";Domain=domain.com;Max-Age=2;" + "Path=/path;Secure;Version=1", c.toString()); }