@Test
public void testShouldFailIfKeyIdNotFound() throws Exception {

  RewardedAdsVerifier verifier =
      new RewardedAdsVerifier.Builder()
          .setVerifyingPublicKeys(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON)
          .build();
  try {
    verifier.verify(signUrl(REWARD_URL, GOOGLE_SIGNING_PRIVATE_KEY_PKCS8_BASE64, KEY_ID + 1));
    fail("Expected GeneralSecurityException");
  } catch (GeneralSecurityException e) {
    assertTrue(e.getMessage().contains("cannot find verifying key with key id"));
  }
}