@Test
public void testLoadSecretKeyFromHttpsJwks() throws Exception {

    JWTAuthContextInfo contextInfo = new JWTAuthContextInfo("https://github.com/my_key.jwks", "issuer");
    contextInfo.setJwksRefreshInterval(10);
    KeyLocationResolver keyLocationResolver = new KeyLocationResolver(contextInfo) {
        protected HttpsJwks initializeHttpsJwks(String loc) {
            return mockedHttpsJwks;
        }
    };
    OctetSequenceJsonWebKey jwk = new OctetSequenceJsonWebKey(secretKey);
    jwk.setKeyId("1");
    when(mockedHttpsJwks.getJsonWebKeys()).thenReturn(Collections.singletonList(jwk));
    keyLocationResolver = Mockito.spy(keyLocationResolver);
    when(signature.getHeaders()).thenReturn(headers);
    when(headers.getStringHeaderValue(JsonWebKey.KEY_ID_PARAMETER)).thenReturn("1");
    assertEquals(secretKey, keyLocationResolver.resolveKey(signature, emptyList()));
    assertNull(keyLocationResolver.key);
}