NewCookieHeaderDelegate implements RuntimeDelegate.HeaderDelegate<NewCookie> { @Override public NewCookie fromString(String header) { checkArgument(header != null); return parseNewCookie(header); }  @Override NewCookie fromString(String header); @Override String toString(NewCookie cookie);  }
@Test public void testFromString() throws Exception { NewCookie expectedNewCookie = new NewCookie("company", "codenvy", "/path", "codenvy.com", 1, "comment", 300, null, true, true); NewCookie parsedNewCookie = newCookieHeaderDelegate.fromString("company=codenvy;version=1;paTh=/path;Domain=codenvy.com;comment=\"comment\";max-age=300;HttpOnly;secure"); assertEquals(expectedNewCookie, parsedNewCookie); }
@Test(expected = IllegalArgumentException.class) public void throwsExceptionWhenNewCookieHeaderIsNull() throws Exception { newCookieHeaderDelegate.fromString(null); }