@Test public void builderClampsMinDate() throws Exception { Cookie cookie = new Cookie.Builder() .name("a") .value("b") .hostOnlyDomain("example.com") .expiresAt(date("1970-01-01T00:00:00.000+0000").getTime()) .build(); assertThat(cookie.toString()).isEqualTo("a=b; max-age=0; path=/"); }
@Override public String toString() { StringBuilder result = new StringBuilder(); result.append(name); result.append('='); result.append(value); if (persistent) { if (expiresAt == Long.MIN_VALUE) { result.append("; max-age=0"); } else { result.append("; expires=").append(STANDARD_DATE_FORMAT.format(new Date(expiresAt))); } } if (!hostOnly) { result.append("; domain="); result.append(domain); } result.append("; path=").append(path); if (secure) { result.append("; secure"); } if (httpOnly) { result.append("; httponly"); } return result.toString(); }
Cookie { @Override public String toString() { StringBuilder result = new StringBuilder(); result.append(name); result.append('='); result.append(value); if (persistent) { if (expiresAt == Long.MIN_VALUE) { result.append("; max-age=0"); } else { result.append("; expires=").append(STANDARD_DATE_FORMAT.format(new Date(expiresAt))); } } if (!hostOnly) { result.append("; domain="); result.append(domain); } result.append("; path=").append(path); if (secure) { result.append("; secure"); } if (httpOnly) { result.append("; httponly"); } return result.toString(); } }
Cookie { @Override public String toString() { StringBuilder result = new StringBuilder(); result.append(name); result.append('='); result.append(value); if (persistent) { if (expiresAt == Long.MIN_VALUE) { result.append("; max-age=0"); } else { result.append("; expires=").append(STANDARD_DATE_FORMAT.format(new Date(expiresAt))); } } if (!hostOnly) { result.append("; domain="); result.append(domain); } result.append("; path=").append(path); if (secure) { result.append("; secure"); } if (httpOnly) { result.append("; httponly"); } return result.toString(); } private  Cookie(String name, String value, long expiresAt, String domain, String path,
                   boolean secure, boolean httpOnly, boolean hostOnly, boolean persistent); private  Cookie(Builder builder); }
Cookie { @Override public String toString() { StringBuilder result = new StringBuilder(); result.append(name); result.append('='); result.append(value); if (persistent) { if (expiresAt == Long.MIN_VALUE) { result.append("; max-age=0"); } else { result.append("; expires=").append(STANDARD_DATE_FORMAT.format(new Date(expiresAt))); } } if (!hostOnly) { result.append("; domain="); result.append(domain); } result.append("; path=").append(path); if (secure) { result.append("; secure"); } if (httpOnly) { result.append("; httponly"); } return result.toString(); } private  Cookie(String name, String value, long expiresAt, String domain, String path,
                   boolean secure, boolean httpOnly, boolean hostOnly, boolean persistent); private  Cookie(Builder builder); String getName(); String getValue(); boolean getPersistent(); long getExpiresAt(); boolean getHostOnly(); String getDomain(); String getPath(); boolean getHttpOnly(); boolean getSecure(); static List<Cookie> parseAll(List<String> cookieStrings); static Cookie parse(String setCookie); @Override String toString(); boolean similarTo(Cookie other); @Override boolean equals(Object other); @Override int hashCode(); }
Cookie { @Override public String toString() { StringBuilder result = new StringBuilder(); result.append(name); result.append('='); result.append(value); if (persistent) { if (expiresAt == Long.MIN_VALUE) { result.append("; max-age=0"); } else { result.append("; expires=").append(STANDARD_DATE_FORMAT.format(new Date(expiresAt))); } } if (!hostOnly) { result.append("; domain="); result.append(domain); } result.append("; path=").append(path); if (secure) { result.append("; secure"); } if (httpOnly) { result.append("; httponly"); } return result.toString(); } private  Cookie(String name, String value, long expiresAt, String domain, String path,
                   boolean secure, boolean httpOnly, boolean hostOnly, boolean persistent); private  Cookie(Builder builder); String getName(); String getValue(); boolean getPersistent(); long getExpiresAt(); boolean getHostOnly(); String getDomain(); String getPath(); boolean getHttpOnly(); boolean getSecure(); static List<Cookie> parseAll(List<String> cookieStrings); static Cookie parse(String setCookie); @Override String toString(); boolean similarTo(Cookie other); @Override boolean equals(Object other); @Override int hashCode();  }