Repository: syncope
Updated Branches:
  refs/heads/2_0_X 775cc672d -> 69a0fe453
  refs/heads/master 75af36991 -> 95c933ac8


Simplifying test logic


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/83f96bbd
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/83f96bbd
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/83f96bbd

Branch: refs/heads/2_0_X
Commit: 83f96bbd51b0ef7f746963ff28e1369097271eaa
Parents: 775cc67
Author: Francesco Chicchiriccò <ilgro...@apache.org>
Authored: Mon Jun 5 16:15:34 2017 +0200
Committer: Francesco Chicchiriccò <ilgro...@apache.org>
Committed: Mon Jun 5 16:15:34 2017 +0200

----------------------------------------------------------------------
 .../core/provisioning/java/ConnectorManagerTest.java | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/83f96bbd/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
----------------------------------------------------------------------
diff --git 
a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
 
b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
index 1b2e060..0434619 100644
--- 
a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
+++ 
b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
@@ -20,6 +20,8 @@ package org.apache.syncope.core.provisioning.java;
 
 import static org.junit.Assert.assertEquals;
 
+import org.apache.commons.collections4.IterableUtils;
+import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 import 
org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
@@ -57,15 +59,16 @@ public class ConnectorManagerTest extends AbstractTest {
         connManager.load();
 
         // only consider local connector bundles
-        int expected = 0;
-        for (ExternalResource resource : resourceDAO.findAll()) {
-            if (resource.getConnector().getLocation().startsWith("file")) {
-                expected++;
+        long expected = IterableUtils.countMatches(resourceDAO.findAll(), new 
Predicate<ExternalResource>() {
+
+            @Override
+            public boolean evaluate(final ExternalResource resource) {
+                return 
resource.getConnector().getLocation().startsWith("file");
             }
-        }
+        });
 
         assertEquals(expected,
                 ApplicationContextProvider.getBeanFactory().
-                getBeanNamesForType(Connector.class, false, true).length);
+                        getBeanNamesForType(Connector.class, false, 
true).length);
     }
 }

Reply via email to