SLING-8986 fix regression with Collection field types
diff --git a/core/src/main/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtil.java b/core/src/main/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtil.java
index 27135b9..8adb41b 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtil.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtil.java
@@ -592,7 +592,7 @@
     @SuppressWarnings({ "unchecked", "null" })
     private static @NotNull Collection<Object> newCollectionInstance(Class<?> collectionType)
             throws InstantiationException, IllegalAccessException {
-        if (collectionType == List.class) {
+        if (collectionType == List.class || collectionType == Collection.class) {
             return new ArrayList<>();
         }
         if (collectionType == Set.class) {
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilTest.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilTest.java
index e22a64e..e5939b3 100644
--- a/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilTest.java
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilTest.java
@@ -26,6 +26,7 @@
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Dictionary;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -133,6 +134,10 @@
         assertEquals(1, references3Set.size());
         assertSame(service2, references3Set.iterator().next());
 
+        Collection<ServiceSuperInterface3> references3Collection = service3.getReferences3Collection();
+        assertEquals(1, references3Collection.size());
+        assertSame(service2, references3Collection.iterator().next());
+
         assertTrue(MockOsgi.deactivate(service3, bundleContext));
         assertNull(service3.getComponentContext());
     }
@@ -396,6 +401,7 @@
         private List<ServiceSuperInterface3> references3Filtered;
         private ServiceSuperInterface3 reference3DynamicFiltered;
         private Set<ServiceSuperInterface3> references3Set;
+        private Collection<ServiceSuperInterface3> references3Collection;
 
         private ComponentContext componentContext;
         private Map<String, Object> config;
@@ -449,6 +455,10 @@
             return this.references3Set;
         }
 
+        public Collection<ServiceSuperInterface3> getReferences3Collection() {
+            return this.references3Collection;
+        }
+
         public ComponentContext getComponentContext() {
             return this.componentContext;
         }
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.xml
index 8bb4422..751c55f 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.xml
@@ -54,6 +54,7 @@
     <reference name="references3Filtered" interface="org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest$ServiceInterface3" cardinality="0..n" policy="dynamic" field="references3Filtered" field-collection-type="service" target="(prop1=abc)"/>
     <reference name="reference3DynamicFiltered" interface="org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest$ServiceInterface3" cardinality="0..1" policy="dynamic" field="reference3DynamicFiltered" field-collection-type="service"/>
     <reference name="reference3Set" interface="org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest$ServiceInterface3" cardinality="0..n" policy="dynamic" field="references3Set" field-collection-type="service"/>
+    <reference name="reference3Collection" interface="org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest$ServiceInterface3" cardinality="0..n" policy="dynamic" field="references3Collection" field-collection-type="service"/>
   </scr:component>
   <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest$Service3StaticGreedy" activate="activate" deactivate="deactivate" modified="modified">
     <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest$Service3StaticGreedyImpl"/>