jweForEncrypt.setKey(key);
String compactSerialization = jweForEncrypt.getCompactSerialization();
JsonWebEncryption jweForDecrypt = new JsonWebEncryption();
jweForDecrypt.setAlgorithmConstraints(new AlgorithmConstraints(WHITELIST, DIRECT));
jweForDecrypt.setContentEncryptionAlgorithmConstraints(new AlgorithmConstraints(WHITELIST, AES_128_CBC_HMAC_SHA_256));
jweForDecrypt.setCompactSerialization(compactSerialization);
jweForDecrypt.setKey(key);
assertEquals(plaintext, jweForDecrypt.getPlaintextString());
}