You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2016/06/27 20:45:48 UTC

commons-crypto git commit: Check that class is instantiated correctly

Repository: commons-crypto
Updated Branches:
  refs/heads/master d4f1a57aa -> 0746a877c


Check that class is instantiated correctly

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

Branch: refs/heads/master
Commit: 0746a877c05c57f2edf0200e2a1fe314883bde87
Parents: d4f1a57
Author: Sebb <se...@apache.org>
Authored: Mon Jun 27 21:45:45 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Mon Jun 27 21:45:45 2016 +0100

----------------------------------------------------------------------
 .../commons/crypto/random/TestOsCryptoRandom.java | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/0746a877/src/test/java/org/apache/commons/crypto/random/TestOsCryptoRandom.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/crypto/random/TestOsCryptoRandom.java b/src/test/java/org/apache/commons/crypto/random/TestOsCryptoRandom.java
index 9f0b149..fe04203 100644
--- a/src/test/java/org/apache/commons/crypto/random/TestOsCryptoRandom.java
+++ b/src/test/java/org/apache/commons/crypto/random/TestOsCryptoRandom.java
@@ -17,12 +17,26 @@
  */
 package org.apache.commons.crypto.random;
 
+import static org.junit.Assert.fail;
+
+import java.security.GeneralSecurityException;
 import java.util.Properties;
 
+import org.apache.commons.crypto.conf.ConfigurationKeys;
+
 public class TestOsCryptoRandom extends AbstractRandomTest {
 
     @Override
-    public CryptoRandom getCryptoRandom() {
-        return new OsCryptoRandom(new Properties());
+    public CryptoRandom getCryptoRandom() throws GeneralSecurityException {
+        Properties props = new Properties();
+        props.setProperty(
+                ConfigurationKeys.SECURE_RANDOM_CLASSES_KEY,
+                OsCryptoRandom.class.getName());
+        CryptoRandom random = CryptoRandomFactory.getCryptoRandom(props);
+        if (!(random instanceof OsCryptoRandom)) {
+            fail("The CryptoRandom should be: "
+                    + OsCryptoRandom.class.getName());
+        }
+        return random;
     }
 }