@Test
  /**
   * Verify that all certificates returned will validate signForApp(). Any invalid signature or
   * exception will cause the test to fail.
   */
  public void testSignForApp() throws Exception {
    Collection<PublicCertificate> certs = appIdentity.getPublicCertificatesForApp();
    byte[] blob = "abcdefg".getBytes();
    AppIdentityService.SigningResult result = appIdentity.signForApp(blob);
    byte[] signedBlob = result.getSignature();
    boolean res = verifySignatureWithAllCertsForApp(blob, signedBlob, certs);

    // assertTrue(res) returns null, so using assertEquals()
    Assert.assertEquals("signature.verify() returned false. See logs.", true, res);
    Assert.assertTrue(!result.getKeyName().isEmpty());
  }