@Test
    void verifyEncryptionFails() {
        val secret = new DefaultRandomStringGenerator().getNewString(16);
        val key = new AesKey(secret.getBytes(StandardCharsets.UTF_8));
        val encryptor = JsonWebTokenEncryptor.builder()
            .key(key)
            .headers(Map.of("name", "value"))
            .algorithm("dir")
            .keyId(UUID.randomUUID().toString())
            .allowedContentEncryptionAlgorithms(Set.of("A256GCM"))
            .encryptionMethod("A128GCM")
            .build();
        assertThrows(IllegalArgumentException.class, () -> encryptor.encrypt("ThisIsATest"));
    }
This is {@link JsonWebTokenEncryptorTests}.

@author Misagh Moayyed
@since 6.6.0
core/cas-server-core-util-api/src/test/java/org/apereo/cas/util/jwt/JsonWebTokenEncryptorTests.java