You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sd...@apache.org on 2016/06/24 08:16:41 UTC

[3/3] commons-crypto git commit: CRYPTO-82: Add Unit Test for InvalidTransformation

CRYPTO-82: Add Unit Test for InvalidTransformation


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

Branch: refs/heads/master
Commit: e90580a892a75ac6350a5a96c70a6a36b696879e
Parents: 6ac3e74
Author: Sun Dapeng <sd...@apache.org>
Authored: Fri Jun 24 16:12:36 2016 +0800
Committer: Sun Dapeng <sd...@apache.org>
Committed: Fri Jun 24 16:12:36 2016 +0800

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


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/e90580a8/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 aeb4be0..0adf826 100644
--- a/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java
+++ b/src/test/java/org/apache/commons/crypto/cipher/CryptoCipherFactoryTest.java
@@ -52,8 +52,8 @@ public class CryptoCipherFactoryTest {
                 "InvalidCipherName");
         CryptoCipher defaultCipher = CryptoCipherFactory.getInstance(
                 "AES/CBC/NoPadding", properties);
-        Assert.assertEquals(JceCipher.class.getName(), defaultCipher.getClass()
-                .getName());
+        Assert.assertEquals(JceCipher.class.getName(),
+            defaultCipher.getClass().getName());
     }
 
     @Test(expected = GeneralSecurityException.class)
@@ -67,4 +67,10 @@ public class CryptoCipherFactoryTest {
 
         CryptoCipherFactory.getInstance("AES/CBC/NoPadding", properties);
     }
+
+    @Test(expected = GeneralSecurityException.class)
+    public void testInvalidTransformation() throws GeneralSecurityException {
+      Properties properties = new Properties();
+      CryptoCipherFactory.getInstance("AES/Invalid/NoPadding", properties);
+    }
 }