[java-opensaml COMMIT] /trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/NamedKeyInfoGenerat...

noreply at shibboleth.net noreply at shibboleth.net
Fri Mar 14 20:11:19 EDT 2014


Author: putmanb
Date: Fri Mar 14 20:11:19 2014
New Revision: 3702

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3702&view=rev
Log:
Fix failing unit test.

Modified:
    trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/NamedKeyInfoGeneratorManagerTest.java

Modified: trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/NamedKeyInfoGeneratorManagerTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/NamedKeyInfoGeneratorManagerTest.java?rev=3702&r1=3701&r2=3702&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/NamedKeyInfoGeneratorManagerTest.java (original)
+++ trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/NamedKeyInfoGeneratorManagerTest.java Fri Mar 14 20:11:19 2014
@@ -227,12 +227,14 @@
         
         Assert.assertNull(manager.getFactory("BAZ", x509Cred), 
                 "Found non-existent factory based on name and credential");
-        try {
-            manager.getFactory("ABC123", x509Cred);
-            Assert.fail("Use of non-existent manager name should have caused an exception");
-        } catch (IllegalArgumentException e) {
-            // do nothing, should fail
-        }        
+        
+        Assert.assertNull(manager.getFactory("ABC123", x509Cred));
+        X509KeyInfoGeneratorFactory myFactory = new X509KeyInfoGeneratorFactory();
+        manager.registerDefaultFactory(myFactory);
+        Assert.assertNotNull(manager.getFactory("ABC123", x509Cred));
+        Assert.assertTrue(myFactory == manager.getFactory("ABC123", x509Cred));
+        manager.deregisterDefaultFactory(myFactory);
+        Assert.assertNull(manager.getFactory("ABC123", x509Cred));
     }
     
     /** Test proper functioning of option to use the default manager for unnamed factories. 



More information about the commits mailing list