@Test
public void testLoadSecretKeyFromHttpsJwks() throws Exception {

    JWTAuthContextInfo contextInfo = new JWTAuthContextInfo();
    contextInfo.setDecryptionKeyLocation("https://github.com/my_key.jwks");
    contextInfo.setJwksRefreshInterval(10);
    DecryptionKeyLocationResolver keyLocationResolver = new DecryptionKeyLocationResolver(contextInfo) {
        protected HttpsJwks initializeHttpsJwks(String loc) {
            return mockedHttpsJwks;
        }
    };
    SecretKey secretKey = new SecretKeySpec("123456789ABCDEF".getBytes(StandardCharsets.UTF_8), "AES");
    OctetSequenceJsonWebKey jwk = new OctetSequenceJsonWebKey(secretKey);
    jwk.setKeyId("1");
    when(mockedHttpsJwks.getJsonWebKeys()).thenReturn(Collections.singletonList(jwk));
    keyLocationResolver = Mockito.spy(keyLocationResolver);
    when(encryption.getHeaders()).thenReturn(headers);
    when(headers.getStringHeaderValue(JsonWebKey.KEY_ID_PARAMETER)).thenReturn("1");
    assertEquals(secretKey, keyLocationResolver.resolveKey(encryption, emptyList()));
    assertNull(keyLocationResolver.key);
}