PublicKeyProvider { public PublicKey get() throws MissingOrInvalidKeyException { return reader.fromPEM(jwtConfiguration.getJwtPublicKeyPem()) .orElseThrow(MissingOrInvalidKeyException::new); } @Inject @VisibleForTesting  PublicKeyProvider(JwtConfiguration jwtConfiguration, PublicKeyReader reader); PublicKey get();  }
@Test public void getShouldNotThrowWhenPEMKeyProvided() { JwtConfiguration configWithPEMKey = new JwtConfiguration(Optional.of(PUBLIC_PEM_KEY)); PublicKeyProvider sut = new PublicKeyProvider(configWithPEMKey, new PublicKeyReader()); assertThat(sut.get()).isInstanceOf(RSAPublicKey.class); }