    @Test
    public void testSerializeNewCookie() {

        RuntimeDelegate rd = RuntimeDelegate.getInstance();
        HeaderDelegate<NewCookie> newCookieHeaderDelegate =
            rd.createHeaderDelegate(NewCookie.class);
        if (newCookieHeaderDelegate == null) {
            fail("NewCookie header delegate is not regestered in RuntimeDelegateImpl");
        }

        String expectedCookieSerialization =
            "MyCookie=MyCookieValue;Version=1;Path=.;Domain=mydomain;Comment=Comment;Max-Age=21600;Secure";
        NewCookie cookieToSerialize =
            new NewCookie("MyCookie", "MyCookieValue", ".", "mydomain", 1, "Comment", 21600, true);
        String serializedCookie = cookieToSerialize.toString();
        assertEquals(expectedCookieSerialization, serializedCookie);

        // Negative test - Invalid cookie
        try {
            newCookieHeaderDelegate.toString(null);
            fail("NewCookie is null - IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            // success
        }

    }