public String encode(String name, String value) {
        return encode(new DefaultCookie(name, value));
    }
@Test
    public void testEncodingSingleCookieV0() throws ParseException {

        int maxAge = 50;

        String result = "myCookie=myValue; Max-Age=50; Expires=(.+?); Path=/apathsomewhere;" +
                " Domain=.adomainsomewhere; Secure; SameSite=Lax; Partitioned";
        DefaultCookie cookie = new DefaultCookie("myCookie", "myValue");
        cookie.setDomain(".adomainsomewhere");
        cookie.setMaxAge(maxAge);
        cookie.setPath("/apathsomewhere");
        cookie.setSecure(true);
        cookie.setSameSite(SameSite.Lax);
        cookie.setPartitioned(true);

        String encodedCookie = ServerCookieEncoder.STRICT.encode(cookie);

        Matcher matcher = Pattern.compile(result).matcher(encodedCookie);
        assertTrue(matcher.find());
        Date expiresDate = DateFormatter.parseHttpDate(matcher.group(1));
        long diff = (expiresDate.getTime() - System.currentTimeMillis()) / 1000;
        // 2 secs should be fine
        assertTrue(Math.abs(diff - maxAge) <= 2);
    }