@Test
public void testGetPublicKey() throws Exception {

    KeyStore keyStoreMock = Mockito.spy(baseKeyStore);
    Mockito.when(keyStoreMock.getPublicKey("domain", "service", "keyId")).thenReturn("public_key_in_pem");
    OAuthCertBoundJwtAccessTokenAuthority authority = new OAuthCertBoundJwtAccessTokenAuthority();
    authority.setKeyStore(keyStoreMock);
    assertEquals(authority.getPublicKey("domain", "service", "keyId"), "public_key_in_pem");
}