commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject commons-crypto git commit: Use JUnit annotation for testing for expected exception
Date Mon, 20 Jun 2016 16:51:08 GMT
Repository: commons-crypto
Updated Branches:
  refs/heads/master f23dcb7d2 -> e4156dafc


Use JUnit annotation for testing for expected exception


Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/e4156daf
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/e4156daf
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/e4156daf

Branch: refs/heads/master
Commit: e4156dafc347e8cb3bdc444dea6867d52f946578
Parents: f23dcb7
Author: Benedikt Ritter <beneritter@gmail.com>
Authored: Mon Jun 20 18:50:59 2016 +0200
Committer: Benedikt Ritter <beneritter@gmail.com>
Committed: Mon Jun 20 18:50:59 2016 +0200

----------------------------------------------------------------------
 .../commons/crypto/cipher/CryptoCipherFactoryTest.java    | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/e4156daf/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java b/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java
index f5f1204..49bd8bc 100644
--- a/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java
+++ b/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java
@@ -57,7 +57,7 @@ public class CryptoCipherFactoryTest {
                 .getName());
     }
 
-    @Test
+    @Test(expected = GeneralSecurityException.class)
     public void testDisableFallback() throws GeneralSecurityException {
         Properties properties = new Properties();
         properties.setProperty(
@@ -65,11 +65,7 @@ public class CryptoCipherFactoryTest {
                 "InvalidCipherName");
         properties.setProperty(ConfigurationKeys
             .COMMONS_CRYPTO_ENABLE_FALLBACK_ON_NATIVE_FAILED_KEY, "false");
-        try {
-            CryptoCipherFactory.getInstance(CipherTransformation.AES_CBC_NOPADDING, properties);
-            fail("Should throw an exception when DisableFallback");
-        } catch (Exception e) {
-            ;
-        }
+
+        CryptoCipherFactory.getInstance(CipherTransformation.AES_CBC_NOPADDING, properties);
     }
 }


Mime
View raw message