### Question:
StigmaTokenFactory { @Nonnull public RawStigmaToken getToken(@Nonnull final Stigma stigma) { Assert.notNull(stigma, "stigma must not be null"); final JWT jwt = getJWT(stigma); return new RawStigmaToken(jwt.serialize()); } StigmaTokenFactory(final EncrypterFactory encrypterFactory); @Nonnull RawStigmaToken getToken(@Nonnull final Stigma stigma);  }### Answer:
@Test void should_create_encrypted_token() throws JOSEException, ParseException { final RawStigmaToken rawStigmaToken = stigmaTokenFactory.getToken(STIGMA); final JWT token = JWTParser.parse(rawStigmaToken.getValue()); assertThat(token).isNotNull().isInstanceOf(EncryptedJWT.class); final EncryptedJWT jwe = (EncryptedJWT) token; assertThat(jwe.getState()).isEqualTo(JWEObject.State.ENCRYPTED); assertThat(jwe.getHeader().getKeyID()).isEqualTo(jwk.getKeyID()); jwe.decrypt(new DirectDecrypter(jwk.toSecretKey())); assertThat(jwe.getState()).isEqualTo(JWEObject.State.DECRYPTED); final Map<String, Object> claims = token.getJWTClaimsSet().getClaims(); assertThat(claims).contains( entry("sub", StigmaConstants.SUBJECT), entry(StigmaConstants.STIGMA_VALUE_FIELD_NAME, STIGMA.getValue()) ); }