@Test
public void shouldSerializeCookieWithAllAttributes() {

    Cookie cookie = new Cookie("name", "value");
    cookie.setDomain("example.com");
    cookie.setMaxAge(20);
    cookie.setSecure(true);
    cookie.setHttpOnly(true);
    cookie.setPath("/somepath");
    cookie.setComment("Some Comment");
    String serializedCookie = cookieHeaderSerializer.serialize(cookie);
    String[] serializedCookieParts = getCookieParts(serializedCookie);
    assertThat(serializedCookie, startsWith("name=value"));
    assertThat(serializedCookie, containsString("Expires"));
    assertThat(getExpiresValue(serializedCookie), endsWith("GMT")); // Pseudo date validation
    assertThat(serializedCookieParts, hasItemInArray("Domain=example.com"));
    assertThat(serializedCookieParts, hasItemInArray("Path=/somepath"));
    assertThat(serializedCookieParts, hasItemInArray("HttpOnly"));
    assertThat(serializedCookieParts, hasItemInArray("Secure"));
    assertThat(serializedCookieParts, hasItemInArray("Comment=Some Comment"));
}