@Test
    void verifyBadKeyCount() throws Throwable {
        val jwks = new JsonWebKeySet();
        val jsonWebKey = mock(PublicJsonWebKey.class);
        jwks.getJsonWebKeys().add(jsonWebKey);

        val loader = mock(OidcDefaultJsonWebKeystoreCacheLoader.class);
        when(loader.buildJsonWebKeySet(any(OidcJsonWebKeyCacheKey.class))).thenCallRealMethod();
        when(loader.load(any(OidcJsonWebKeyCacheKey.class))).thenCallRealMethod();
        when(loader.generateJwksResource()).thenReturn(new ByteArrayResource("jwks".getBytes(StandardCharsets.UTF_8)));
        when(loader.buildJsonWebKeySet(any(Resource.class), any(OidcJsonWebKeyCacheKey.class))).thenReturn(jwks);
        assertNull(loader.load(new OidcJsonWebKeyCacheKey(UUID.randomUUID().toString(), OidcJsonWebKeyUsage.SIGNING)));

        when(jsonWebKey.getAlgorithm()).thenReturn("some-alg");
        assertNull(loader.load(new OidcJsonWebKeyCacheKey(UUID.randomUUID().toString(), OidcJsonWebKeyUsage.SIGNING)));
    }
This is {@link OidcDefaultJsonWebKeystoreCacheLoaderTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-oidc/src/test/java/org/apereo/cas/oidc/jwks/OidcDefaultJsonWebKeystoreCacheLoaderTests.java