JsonCookie { @JsonCreator public static JsonCookie create( @JsonProperty("name") String name, @JsonProperty("value") String value, @JsonProperty("domain") String domain, @JsonProperty("path") String path, @JsonProperty("secure") boolean isSecure, @JsonProperty("httpOnly") boolean isHttpOnly) { return new AutoValue_JsonCookie(name, value, domain, path, isSecure, isHttpOnly); }  @JsonCreator static JsonCookie create(
      @JsonProperty("name") String name,
      @JsonProperty("value") String value,
      @JsonProperty("domain") String domain,
      @JsonProperty("path") String path,
      @JsonProperty("secure") boolean isSecure,
      @JsonProperty("httpOnly") boolean isHttpOnly); static JsonCookie fromHttpCookie(HttpCookie cookie); static HttpCookie toHttpCookie(JsonCookie cookieContents); @JsonProperty abstract String name(); @JsonProperty abstract String value(); @JsonProperty abstract String domain(); @JsonProperty abstract String path(); @JsonProperty abstract boolean isSecure(); @JsonProperty abstract boolean isHttpOnly();  }
@Test public void deserializesCookie() throws Exception { JsonCookie expected = JsonCookie.create("session", "session-contents", "localhost", "/admin", true, true); String json = Resources.toString(Resources.getResource("fixtures/cookie_valid.json"), UTF_8); JsonCookie actual = Jackson.newObjectMapper().readValue(json, JsonCookie.class); assertThat(actual).isEqualTo(expected); }
@Test public void handlesSerializedVersionField() throws Exception { JsonCookie expected = JsonCookie.create("session", "session-contents", "localhost", "/admin", true, true); String json = Resources.toString(Resources.getResource("fixtures/cookie_with_version.json"), UTF_8); JsonCookie actual = Jackson.newObjectMapper().readValue(json, JsonCookie.class); assertThat(actual).isEqualTo(expected); }