### Question:
ZosmfService extends AbstractZosmfService { public JWKSet getPublicKeys() { final String url = getURI(getZosmfServiceId()) + PUBLIC_JWK_ENDPOINT; try { final String json = restTemplateWithoutKeystore.getForObject(url, String.class); return JWKSet.parse(json); } catch (ParseException pe) { log.debug("Invalid format of public keys from z/OSMF", pe); } catch (HttpClientErrorException.NotFound nf) { log.debug("Cannot get public keys from z/OSMF", nf); } return new JWKSet(); } ZosmfService(
        final AuthConfigurationProperties authConfigurationProperties,
        final DiscoveryClient discovery,
        final @Qualifier("restTemplateWithoutKeystore") RestTemplate restTemplateWithoutKeystore,
        final ObjectMapper securityObjectMapper
    ); AuthenticationResponse authenticate(Authentication authentication); @Cacheable("zosmfInfo") String getZosmfRealm(String infoURIEndpoint); @Cacheable("zosmfAuthenticationEndpoint") boolean authenticationEndpointExists(HttpMethod httpMethod); void validate(TokenType type, String token); void invalidate(TokenType type, String token); JWKSet getPublicKeys();  }### Answer:
@Test public void testGetPublicKeys_zosm404() { ZosmfService zosmfService = getZosmfServiceSpy(); when(restTemplate.getForObject(anyString(), any())) .thenThrow(mock(HttpClientErrorException.NotFound.class)); assertTrue(zosmfService.getPublicKeys().getKeys().isEmpty()); }
@Test public void testGetPublicKeys_invalidFormat() { ZosmfService zosmfService = getZosmfServiceSpy(); when(restTemplate.getForObject(anyString(), any())) .thenReturn("invalidFormat"); assertTrue(zosmfService.getPublicKeys().getKeys().isEmpty()); }
@Test public void testGetPublicKeys_success() throws JSONException { ZosmfService zosmfService = getZosmfServiceSpy(); when(restTemplate.getForObject( "http: String.class )).thenReturn(ZOSMF_PUBLIC_KEY_JSON); JSONAssert.assertEquals(ZOSMF_PUBLIC_KEY_JSON, new JSONObject(zosmfService.getPublicKeys().toString()), true); }