@Test
 public void testEncryptionBothWays() throws UnsupportedEncodingException {
   final byte[] message = "this is a top-secret message".getBytes("UTF-8");
   byte[] encryptedMessage = encrypter.encrypt("privateKeyId", message);
   assertNotNull(encryptedMessage);
   byte[] decryptedMessage = decrypter.encrypt("publicKeyId", encryptedMessage);
   assertNotNull(decryptedMessage);
   assertArrayEquals(message, decryptedMessage);
 }
 @Test
 public void testEncryptionBothWaysInALoop() throws UnsupportedEncodingException {
   for (int i = 0; i < 100; i++) {
     final byte[] message = UUID.randomUUID().toString().getBytes("UTF-8");
     byte[] encryptedMessage = encrypter.encrypt("privateKeyId", message);
     assertNotNull(encryptedMessage);
     byte[] decryptedMessage = decrypter.encrypt("publicKeyId", encryptedMessage);
     assertNotNull(decryptedMessage);
     assertArrayEquals(message, decryptedMessage);
   }
 }
 @Test(expected = AsymmetricEncryptionException.class)
 public void testDecryptionWithGarbageFails() throws UnsupportedEncodingException {
   final byte[] message = "this is garbage".getBytes("UTF-8");
   decrypter.encrypt("publicKeyId", message);
 }