@Test
 public void testEncryptionExceptionStringThrowable() {
   String message = "foo";
   Throwable throwable = new Throwable();
   EncryptionException encryptionException = new EncryptionException(message, throwable);
   assertEquals("Must be the same", message, encryptionException.getMessage());
   assertEquals("Must be the same", throwable, encryptionException.getCause());
 }
Exemplo n.º 2
0
 @SuppressWarnings({"PMD.SystemPrintln", "PMD.AvoidPrintStackTrace"})
 public static void main(String[] args) {
   try {
     String k = Encryption.getStringKey();
     System.out.println("Your secret key is:");
     System.out.println(k);
     System.out.println("Sample encrypted string with the above key for 'thisIsMyPassword' is:");
     System.out.println(Encryption.encryptString("thisIsMyPassword", k));
   } catch (EncryptionException e) {
     e.printStackTrace();
   }
 }
 @Test
 public void testEncryptionExceptionThrowable() {
   Throwable throwable = new Throwable();
   EncryptionException encryptionException = new EncryptionException(throwable);
   assertEquals("Must be the same", throwable, encryptionException.getCause());
 }
 @Test
 public void testEncryptionExceptionString() {
   String message = "foo";
   EncryptionException encryptionException = new EncryptionException(message);
   assertEquals("Must be the same", message, encryptionException.getMessage());
 }