'How to mock new GuavaCachedJwkProvider creation?

I want to mock 3 line here as part of my unit testing, but not sure how can I do so. I need to skip new GuavaCachedJwkProvider creation.

private void verifyTokenSignature(final DecodedJWT decodedToken) {
    try {
        final JwkProvider provider = new GuavaCachedJwkProvider(jwkProviderConfig.getUrlJwkProvider(),
                jwkProviderConfig.getSize(), jwkProviderConfig.getExpiresIn(), jwkProviderConfig.getTimeUnit());
        final Jwk jwk = provider.get(decodedToken.getKeyId());
        final Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) jwk.getPublicKey(), null);
        algorithm.verify(decodedToken);

    } catch (final InvalidPublicKeyException ex) {
        log.error("Invalid public key");
        throw new InvalidBeneficiaryTokenException("Invalid public key");

    } catch (final JwkException ex) {
        log.error(String.format("No jwk in response, for such kid: %s", decodedToken.getKeyId()));
        throw new InvalidBeneficiaryTokenException("No jwk in response, for such kid");

    } catch (final SignatureVerificationException ex) {
        log.error("Invalid token signature");
        throw new InvalidBeneficiaryTokenException("Invalid token signature");
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source