@Test
    void verifyNotAllowedAlgorithm() {
        val secret = EncodingUtils.generateJsonWebKey(256);
        val key = new AesKey(secret.getBytes(StandardCharsets.UTF_8));

        assertThrowsWithRootCause(
            UncheckedException.class, InvalidAlgorithmException.class,
            () -> JsonWebTokenSigner.builder()
                .allowedAlgorithms(Set.of(AlgorithmIdentifiers.HMAC_SHA512))
                .key(key)
                .headers(Map.of("name", "value"))
                .algorithm(AlgorithmIdentifiers.HMAC_SHA256)
                .build()
                .sign("ThisIsATest".getBytes(StandardCharsets.UTF_8)));
    }
This is {@link JsonWebTokenSignerTests}.

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