### Question:
JwtRememberMeServices extends AbstractRememberMeServices { @Nonnull @Override protected String encodeCookie(@Nonnull final String[] tokens) { final NumericDate expireTime = NumericDate.fromMilliseconds(DateTimeUtils.currentTimeMillis()); expireTime.addSeconds(getExpirationTimeSeconds()); final JwtClaims claims = new JwtClaims(); claims.setExpirationTime(expireTime); claims.setSubject(tokens[0]); claims.setStringListClaim(PRINCIPALS, Arrays.asList(tokens).subList(1, tokens.length)); final JsonWebSignature jws = new JsonWebSignature(); jws.setAlgorithmHeaderValue(algorithmIdentifier); jws.setKey(getSecretKey()); jws.setKeyIdHeaderValue(getSecretKey().getAlgorithm()); jws.setPayload(claims.toJson()); try { return jws.getCompactSerialization(); } catch (final JoseException e) { log.error("Unable to encode cookie: ", e); throw new IllegalStateException("Unable to encode cookie: ", e); } } JwtRememberMeServices(@Nonnull final JwtProperties properties);   }### Answer:
@Test public void encodeCookie() { String actual = service.encodeCookie(new String[]{"user"}); String expected = "eyJhbGciOiJIUzI1NiIsImtpZCI6IkhNQUMifQ.eyJleHAiOjE0NjMxNTE5MDAsInN1YiI6InVzZXIiLCJwcmluY2lwYWxzIjpbXX0.q76UatxiKI95uDZtCL1Oc48dBjXfhSgb1SpBkMAjP_E"; Assert.assertEquals(expected, actual); actual = service.encodeCookie(new String[]{"dladmin", groupPrincipalsJson("admin")}); expected = "eyJhbGciOiJIUzI1NiIsImtpZCI6IkhNQUMifQ.eyJleHAiOjE0NjMxNTE5MDAsInN1YiI6ImRsYWRtaW4iLCJwcmluY2lwYWxzIjpbIntcImNvbS50aGlua2J" + "pZ2FuYWx5dGljcy5zZWN1cml0eS5Hcm91cFByaW5jaXBhbFwiOltcImFkbWluXCJdfSJdfQ.DH4pxE8eWCmqPlhFMiEAbBja5k833gg0guE6m8DXvIA"; Assert.assertEquals(expected, actual); actual = service.encodeCookie(new String[]{"dladmin", groupPrincipalsJson("designers", "operators")}); expected = "eyJhbGciOiJIUzI1NiIsImtpZCI6IkhNQUMifQ.eyJleHAiOjE0NjMxNTE5MDAsInN1YiI6ImRsYWRtaW4iLCJwcmluY2lwYWxzIjpbIntcImNvbS50aGlua2J" + "pZ2FuYWx5dGljcy5zZWN1cml0eS5Hcm91cFByaW5jaXBhbFwiOltcImRlc2lnbmVyc1wiLFwib3BlcmF0b3JzXCJdfSJdfQ.kESqgybFd5uyOn1Mjy5dUgwjE24-MstYZjysXS58G8s"; Assert.assertEquals(expected, actual); }