@UseDataProvider("forParsesNewCookies")
@Test
public void parsesNewCookies(String cookieHeader, NewCookie expectedNewCookie) {

    NewCookie newCookie = HeaderHelper.parseNewCookie(cookieHeader);
    assertNotNull(newCookie);
    assertEquals(expectedNewCookie.getName(), newCookie.getName());
    assertEquals(expectedNewCookie.getValue(), newCookie.getValue());
    if (expectedNewCookie.getExpiry() != null) {
        assertTrue(String.format("Expiry dates are not equal. Expected %s, actual %s", expectedNewCookie.getExpiry(), newCookie.getExpiry()),
                   Math.abs(expectedNewCookie.getExpiry().getTime() - newCookie.getExpiry().getTime()) < 1000);
    }
    assertEquals(expectedNewCookie.getMaxAge(), newCookie.getMaxAge());
    assertEquals(expectedNewCookie.getPath(), newCookie.getPath());
    assertEquals(expectedNewCookie.getDomain(), newCookie.getDomain());
    assertEquals(expectedNewCookie.getComment(), newCookie.getComment());
    assertEquals(expectedNewCookie.getVersion(), newCookie.getVersion());
    assertEquals(expectedNewCookie.isSecure(), newCookie.isSecure());
    assertEquals(expectedNewCookie.isHttpOnly(), newCookie.isHttpOnly());
}