@Override
    public void onCompletion(EncryptJob.EncryptJobResult encryptJobResult, Exception exception) {
      if (countDownLatch != null) {
        countDownLatch.countDown();
      }
      if (!expectException) {
        ByteBuf encryptedBlobContent = encryptJobResult.getEncryptedBlobContent();
        assertNull("Exception shouldn't have been thrown to encrypt contents for " + blobId, exception);
        if (mode != Mode.UserMetadata) {
          assertNotNull("Encrypted content should not be null", encryptedBlobContent);
        }
        if (mode != Mode.Data) {
          assertNotNull("Encrypted userMetadata should not be null", encryptJobResult.getEncryptedUserMetadata());
        }
        assertNotNull("Encrypted key should not be null", encryptJobResult.getEncryptedKey());
        cryptoJobHandler.submitJob(new DecryptJob(blobId, encryptJobResult.getEncryptedKey(),
            encryptedBlobContent != null ? encryptedBlobContent.retainedDuplicate() : null,
            encryptJobResult.getEncryptedUserMetadata(), cryptoService, kms, null,
            new CryptoJobMetricsTracker(routerMetrics.decryptJobMetrics), (result, e) -> {
          decryptCallBackVerifier.onCompletion(result, e);
        }));
        if (encryptedBlobContent != null) {
          encryptedBlobContent.release();
        }
      } else {
        assertNotNull("Exception should have been thrown to encrypt contents for " + blobId, exception);
        assertTrue("Exception cause should have been GeneralSecurityException",
            exception instanceof GeneralSecurityException);
        assertNull("Result should have been null", encryptJobResult);
      }
    }
Encrypt callback verifier. Verifies non null for arguments and adds a decrypt job to the jobQueue on successful completion.
Else, verifies the exception is set correctly.
ambry-router/src/test/java/com/github/ambry/router/CryptoJobHandlerTest.java