OAuthCertBoundJwtAccessTokenAuthority implements Authority, AuthorityKeyStore, KeyStore { @Override public String getPublicKey(String domain, String service, String keyId) { return this.keyStore.getPublicKey(domain, service, keyId); }  @Override void setKeyStore(KeyStore keyStore); @Override String getPublicKey(String domain, String service, String keyId); @Override CredSource getCredSource(); @Override String getAuthenticateChallenge(); @Override String getDomain(); @Override String getHeader(); @Override Principal authenticate(String credentials, String remoteAddr, String httpMethod, StringBuilder errMsg); @Override void initialize(); @Override Principal authenticate(HttpServletRequest request, StringBuilder errMsg);  }
@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"); }