Bug 577522 - Update to newer easymock

Change-Id: Ibbf5447233a02578244c274e855f2a088b5f9d92
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/188359
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Mickael Istria <mistria@redhat.com>
diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
index da3392d..feb1cc7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
@@ -26,7 +26,6 @@
  org.eclipse.core.tests.harness;bundle-version="3.4.0",
  org.eclipse.core.runtime;bundle-version="3.4.0",
  org.eclipse.equinox.p2.publisher;bundle-version="1.0.0",
- org.easymock;bundle-version="[2.4.0,3.0.0)",
  org.eclipse.equinox.frameworkadmin.test;bundle-version="1.0.0",
  org.junit;bundle-version="4.8.0",
  org.hamcrest.core;bundle-version="1.3.0",
@@ -113,5 +112,6 @@
  org.eclipse.osgi.util;version="1.1.0",
  org.osgi.framework;version="1.3.0",
  org.osgi.service.packageadmin;version="1.2.0",
- org.osgi.util.tracker;version="1.3.0"
+ org.osgi.util.tracker;version="1.3.0",
+ org.easymock;version="4.0.0"
 Automatic-Module-Name: org.eclipse.equinox.p2.tests
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java
index 66707af..480303b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java
@@ -26,7 +26,9 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.equinox.frameworkadmin.BundleInfo;
 import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData;
-import org.eclipse.equinox.p2.publisher.eclipse.*;
+import org.eclipse.equinox.p2.publisher.eclipse.AccumulateConfigDataAction;
+import org.eclipse.equinox.p2.publisher.eclipse.ConfigAdvice;
+import org.eclipse.equinox.p2.publisher.eclipse.LaunchingAdvice;
 import org.eclipse.equinox.p2.tests.TestActivator;
 
 public class AccumulateConfigDataActionTest extends ActionTest {
@@ -46,8 +48,8 @@
 
 	@Override
 	public void setUp() throws Exception {
-		configAdviceCapture = new Capture<>();
-		launchingAdviceCapture = new Capture<>();
+		configAdviceCapture = Capture.newInstance();
+		launchingAdviceCapture = Capture.newInstance();
 		setupPublisherInfo();
 		setupPublisherResult();
 		testAction = new AccumulateConfigDataAction(publisherInfo, configSpec, configLocation, executableLocation);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
index df719ad..72bde81 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
@@ -39,6 +39,8 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.zip.ZipInputStream;
+import org.easymock.Capture;
+import org.easymock.CaptureType;
 import org.easymock.EasyMock;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -142,17 +144,17 @@
 
 	protected TestArtifactRepository artifactRepository = new TestArtifactRepository(getAgent());
 
-	private MultiCapture<ITouchpointAdvice> tpAdvice1, tpAdvice2;
-	private MultiCapture<IUpdateDescriptorAdvice> udAdvice3;
-	private MultiCapture<ICapabilityAdvice> capAdvice5;
+	private Capture<ITouchpointAdvice> tpAdvice1, tpAdvice2;
+	private Capture<IUpdateDescriptorAdvice> udAdvice3;
+	private Capture<ICapabilityAdvice> capAdvice5;
 
 	@Override
 	public void setupPublisherInfo() {
-		tpAdvice1 = new MultiCapture<>();
-		tpAdvice2 = new MultiCapture<>();
+		tpAdvice1 = Capture.newInstance(CaptureType.ALL);
+		tpAdvice2 = Capture.newInstance(CaptureType.ALL);
 
-		udAdvice3 = new MultiCapture<>();
-		capAdvice5 = new MultiCapture<>();
+		udAdvice3 = Capture.newInstance(CaptureType.ALL);
+		capAdvice5 = Capture.newInstance(CaptureType.ALL);
 
 		super.setupPublisherInfo();
 	}
@@ -410,16 +412,16 @@
 		expectOtherAdviceQueries(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION);
 		expectPropertyAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, sarProperties);
 		expectUpdateDescriptorAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, null);
-		expectTouchpointAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, tpAdvice1);
+		expectTouchpointAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, tpAdvice1.getValues());
 
 		expectOtherAdviceQueries(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION);
 		expectPropertyAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, sdkProperties);
 		expectUpdateDescriptorAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, null);
-		expectTouchpointAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, tpAdvice2);
+		expectTouchpointAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, tpAdvice2.getValues());
 
 		expectOtherAdviceQueries(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION);
 		expectPropertyAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, sarProperties);
-		expectUpdateDescriptorAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, udAdvice3);
+		expectUpdateDescriptorAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, udAdvice3.getValues());
 		expectTouchpointAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, null);
 
 		expectOtherAdviceQueries(TEST4_PROV_BUNDLE_NAME, BUNDLE4_VERSION);
@@ -427,7 +429,7 @@
 		expectUpdateDescriptorAdviceQuery(TEST4_PROV_BUNDLE_NAME, BUNDLE4_VERSION, null);
 		expectTouchpointAdviceQuery(TEST4_PROV_BUNDLE_NAME, BUNDLE4_VERSION, null);
 
-		expectCapabilityAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, capAdvice5);
+		expectCapabilityAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, capAdvice5.getValues());
 		expectOtherAdviceQueries(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION);
 		expectPropertyAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, sarProperties);
 		expectUpdateDescriptorAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, null);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
index a83f52b..bae3a46 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
@@ -80,7 +80,7 @@
 	@Override
 	public void setUp() throws Exception {
 		testAction = new FeaturesAction(new File[] {root});
-		tpAdvice = new Capture<>();
+		tpAdvice = Capture.newInstance();
 		setupPublisherInfo();
 		setupPublisherResult();
 	}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java
deleted file mode 100644
index 3f9d813..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.p2.tests.publisher.actions;
-
-import java.util.*;
-import org.easymock.Capture;
-
-/**
- * A capture that captures multiple values
- */
-public class MultiCapture<T> extends Capture<T> implements Collection<T> {
-	private static final long serialVersionUID = 1L;
-	private final List<T> captured = new ArrayList<>();
-
-	@Override
-	public boolean add(T arg0) {
-		return captured.add(arg0);
-	}
-
-	@Override
-	public boolean addAll(Collection<? extends T> arg0) {
-		return captured.addAll(arg0);
-	}
-
-	@Override
-	public void clear() {
-		captured.clear();
-	}
-
-	@Override
-	public boolean contains(Object arg0) {
-		return captured.contains(arg0);
-	}
-
-	@Override
-	public boolean containsAll(Collection<?> arg0) {
-		return captured.containsAll(arg0);
-	}
-
-	@Override
-	public boolean isEmpty() {
-		return captured.isEmpty();
-	}
-
-	@Override
-	public Iterator<T> iterator() {
-		return captured.iterator();
-	}
-
-	@Override
-	public boolean remove(Object arg0) {
-		return captured.remove(arg0);
-	}
-
-	@Override
-	public boolean removeAll(Collection<?> arg0) {
-		return captured.removeAll(arg0);
-	}
-
-	@Override
-	public boolean retainAll(Collection<?> arg0) {
-		return captured.retainAll(arg0);
-	}
-
-	@Override
-	public void setValue(T value) {
-		captured.add(value);
-		super.setValue(value);
-	}
-
-	@Override
-	public int size() {
-		return captured.size();
-	}
-
-	@Override
-	public Object[] toArray() {
-		return captured.toArray();
-	}
-
-	@Override
-	public <X> X[] toArray(X[] arg0) {
-		return captured.toArray(arg0);
-	}
-}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
index ffddce2..eb9a2d1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
@@ -73,8 +73,8 @@
 
 	@Override
 	public void setUp() throws Exception {
-		rootIUAdviceCapture = new Capture<>();
-		productFileAdviceCapture = new Capture<>();
+		rootIUAdviceCapture = Capture.newInstance();
+		productFileAdviceCapture = Capture.newInstance();
 		setupPublisherInfo();
 		setupPublisherResult();
 	}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
index 87a4550..a14b660 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
@@ -66,8 +66,8 @@
 	@Override
 	public void setUp() throws Exception {
 		configSpec = AbstractPublisherAction.createConfigSpec("carbon", "macosx", "x86");
-		rootIUAdviceCapture = new Capture<>();
-		productFileAdviceCapture = new Capture<>();
+		rootIUAdviceCapture = Capture.newInstance();
+		productFileAdviceCapture = Capture.newInstance();
 		setupPublisherInfo();
 		setupPublisherResult();
 	}