Bug 560625 - ui.tests.performance tests run with errors

Get rid of TestRunnable. java.lang.Runnable works perfectly as this is
test code so the unchecked AssertionError can be used freely.

Change-Id: I49b0e8513291268aa76653b1f9760b1312a560a0
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ComboViewerRefreshTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ComboViewerRefreshTest.java
index a32b9ee..d85e343 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ComboViewerRefreshTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ComboViewerRefreshTest.java
@@ -17,7 +17,6 @@
 import org.eclipse.jface.viewers.ComboViewer;
 import org.eclipse.jface.viewers.StructuredViewer;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 /**
  * ComboViewerRefreshTest is a test of refreshes of difference size in the combo
@@ -60,14 +59,11 @@
 		ELEMENT_COUNT = 1000;
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				viewer.refresh();
-				processEvents();
-				stopMeasuring();
-			}
+		exercise(() -> {
+			startMeasuring();
+			viewer.refresh();
+			processEvents();
+			stopMeasuring();
 		}, MIN_ITERATIONS, ITERATIONS, JFacePerformanceSuite.MAX_TIME);
 
 		commitMeasurements();
@@ -83,16 +79,13 @@
 		ELEMENT_COUNT = 50;
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				for (int i = 0; i < 1000; i++) {
-					viewer.refresh();
-				}
-				processEvents();
-				stopMeasuring();
+		exercise(() -> {
+			startMeasuring();
+			for (int i = 0; i < 1000; i++) {
+				viewer.refresh();
 			}
+			processEvents();
+			stopMeasuring();
 		}, MIN_ITERATIONS, slowGTKIterations(), JFacePerformanceSuite.MAX_TIME);
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTableViewerRefreshTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTableViewerRefreshTest.java
index 510be1f..fa17232 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTableViewerRefreshTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTableViewerRefreshTest.java
@@ -14,7 +14,6 @@
 package org.eclipse.jface.tests.performance;
 
 import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 public class FastTableViewerRefreshTest extends TableViewerRefreshTest {
 
@@ -34,17 +33,14 @@
 	public void testRefreshMultiple() throws Throwable {
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				for (int i = 0; i < 10; i++) {
-					viewer.refresh();
-					processEvents();
+		exercise(() -> {
+			startMeasuring();
+			for (int i = 0; i < 10; i++) {
+				viewer.refresh();
+				processEvents();
 
-				}
-				stopMeasuring();
 			}
+			stopMeasuring();
 		}, MIN_ITERATIONS, slowGTKIterations(),
 				JFacePerformanceSuite.MAX_TIME);
 
@@ -61,23 +57,20 @@
 		openBrowser();
 
 		exercise(
-				new TestRunnable() {
-					@Override
-					public void run() {
-						startMeasuring();
-						for (int i = 0; i < 10; i++) {
-							TableItem[] items = viewer.getTable().getItems();
-							for (int j = 0; j < items.length; j++) {
-								TableItem item = items[j];
-								Object element = RefreshTestContentProvider.allElements[j];
-								viewer.testUpdateItem(item, element);
-							}
-							processEvents();
+				() -> {
+					startMeasuring();
+					for (int i = 0; i < 10; i++) {
+						TableItem[] items = viewer.getTable().getItems();
+						for (int j = 0; j < items.length; j++) {
+							TableItem item = items[j];
+							Object element = RefreshTestContentProvider.allElements[j];
+							viewer.testUpdateItem(item, element);
 						}
+								processEvents();
+							}
 
-						stopMeasuring();
+							stopMeasuring();
 
-					}
 				}, MIN_ITERATIONS, slowGTKIterations(),
 				JFacePerformanceSuite.MAX_TIME);
 
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTreeTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTreeTest.java
index 25470b0..cbc4a61 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTreeTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FastTreeTest.java
@@ -18,7 +18,6 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.test.performance.Dimension;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 public class FastTreeTest extends TreeAddTest {
 
@@ -71,38 +70,34 @@
 
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
+		exercise(() -> {
 
-				TestTreeElement input = new TestTreeElement(0, null);
-				viewer.setInput(input);
-				input.createChildren(total);
-				if (preSort)
-					viewer.getSorter().sort(viewer, input.children);
-				Collection<Object> batches = new ArrayList<>();
-				int blocks = input.children.length / increment;
-				for (int j = 0; j < blocks; j = j + increment) {
-					Object[] batch = new Object[increment];
-					System.arraycopy(input.children, j * increment, batch, 0,
-							increment);
-					batches.add(batch);
-				}
-				processEvents();
-				Object[] batchArray = batches.toArray();
-				startMeasuring();
-				for (int i = 0; i < 10; i++) {
-					viewer.remove((Object[]) input.children);
-					for (Object batch : batchArray) {
-						viewer.add(input, (Object[]) batch);
-						processEvents();
-					}
-				}
-
-
-				stopMeasuring();
-
+			TestTreeElement input = new TestTreeElement(0, null);
+			viewer.setInput(input);
+			input.createChildren(total);
+			if (preSort)
+				viewer.getSorter().sort(viewer, input.children);
+			Collection<Object> batches = new ArrayList<>();
+			int blocks = input.children.length / increment;
+			for (int j = 0; j < blocks; j = j + increment) {
+				Object[] batch1 = new Object[increment];
+				System.arraycopy(input.children, j * increment, batch1, 0, increment);
+				batches.add(batch1);
 			}
+			processEvents();
+			Object[] batchArray = batches.toArray();
+			startMeasuring();
+			for (int i = 0; i < 10; i++) {
+				viewer.remove((Object[]) input.children);
+				for (Object batch2 : batchArray) {
+					viewer.add(input, (Object[]) batch2);
+					processEvents();
+				}
+			}
+
+
+			stopMeasuring();
+
 		}, MIN_ITERATIONS, ITERATIONS, JFacePerformanceSuite.MAX_TIME);
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FileImageDescriptorTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FileImageDescriptorTest.java
index af0e0f9..98d8bdb 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FileImageDescriptorTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/FileImageDescriptorTest.java
@@ -25,7 +25,6 @@
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.tests.performance.BasicPerformanceTest;
-import org.eclipse.ui.tests.performance.TestRunnable;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.FrameworkUtil;
 
@@ -54,54 +53,48 @@
 	 */
 	public void testRefresh() throws Throwable {
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				Class<?> missing = null;
-				ArrayList<Image> images = new ArrayList<>();
+		exercise(() -> {
+			Class<?> missing = null;
+			ArrayList<Image> images = new ArrayList<>();
 
-				Bundle bundle = FrameworkUtil.getBundle(getClass());
-				Enumeration<String> bundleEntries = bundle
-						.getEntryPaths(IMAGES_DIRECTORY);
+			Bundle bundle = FrameworkUtil.getBundle(getClass());
+			Enumeration<String> bundleEntries = bundle.getEntryPaths(IMAGES_DIRECTORY);
 
 
-				while (bundleEntries.hasMoreElements()) {
-					ImageDescriptor descriptor;
-					String localImagePath = bundleEntries
-							.nextElement();
+			while (bundleEntries.hasMoreElements()) {
+				ImageDescriptor descriptor;
+				String localImagePath = bundleEntries.nextElement();
 
-					if(localImagePath.indexOf('.') < 0)
+				if (localImagePath.indexOf('.') < 0)
+					continue;
+
+				URL[] files = FileLocator.findEntries(bundle, new Path(localImagePath));
+
+				for (URL file : files) {
+					startMeasuring();
+					try {
+						descriptor = ImageDescriptor.createFromFile(missing, FileLocator.toFileURL(file).getFile());
+					} catch (IOException e) {
+						fail(e.getLocalizedMessage(), e);
 						continue;
-
-					URL[] files = FileLocator.findEntries(bundle, new Path(
-							localImagePath));
-
-					for (URL file : files) {
-						startMeasuring();
-						try {
-							descriptor = ImageDescriptor.createFromFile(missing, FileLocator.toFileURL(file).getFile());
-						} catch (IOException e) {
-							fail(e.getLocalizedMessage(), e);
-							continue;
-						}
-
-						for (int j = 0; j < 10; j++) {
-							Image image = descriptor.createImage();
-							images.add(image);
-						}
-
-						processEvents();
-						stopMeasuring();
-
 					}
 
+					for (int j = 0; j < 10; j++) {
+						Image image = descriptor.createImage();
+						images.add(image);
+					}
+
+					processEvents();
+					stopMeasuring();
+
 				}
 
+			}
 
-				Iterator<Image> imageIterator = images.iterator();
-				while (imageIterator.hasNext()) {
-					imageIterator.next().dispose();
-				}
+
+			Iterator<Image> imageIterator = images.iterator();
+			while (imageIterator.hasNext()) {
+				imageIterator.next().dispose();
 			}
 		}, 20, 100, JFacePerformanceSuite.MAX_TIME);
 
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListPopulationTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListPopulationTest.java
index 97dcc9e..be02fe2 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListPopulationTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListPopulationTest.java
@@ -20,7 +20,6 @@
 import org.eclipse.swt.widgets.List;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.tests.performance.BasicPerformanceTest;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 /**
  * The ListPopulationTest is the test for simple
@@ -84,17 +83,14 @@
 		openBrowser();
 		final String [] items = getItems(count);
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				list.removeAll();
-				startMeasuring();
-				for (String item : items) {
-					list.add(item);
-				}
-				processEvents();
-				stopMeasuring();
+		exercise(() -> {
+			list.removeAll();
+			startMeasuring();
+			for (String item : items) {
+				list.add(item);
 			}
+			processEvents();
+			stopMeasuring();
 		});
 
 		commitMeasurements();
@@ -108,15 +104,12 @@
 	public void setItemsBench(int count) throws Throwable {
 		openBrowser();
 		final String [] items = getItems(count);
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				list.removeAll();
-				startMeasuring();
-				list.setItems(items);
-				processEvents();
-				stopMeasuring();
-			}
+		exercise(() -> {
+			list.removeAll();
+			startMeasuring();
+			list.setItems(items);
+			processEvents();
+			stopMeasuring();
 		});
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListViewerRefreshTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListViewerRefreshTest.java
index 24af514..c9f1c5a 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListViewerRefreshTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListViewerRefreshTest.java
@@ -18,7 +18,6 @@
 import org.eclipse.jface.viewers.StructuredViewer;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.test.performance.Dimension;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 /**
  * The ListViewerRefreshTest is a test of refreshing the list viewer.
@@ -62,14 +61,11 @@
 
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				viewer.refresh();
-				processEvents();
-				stopMeasuring();
-			}
+		exercise(() -> {
+			startMeasuring();
+			viewer.refresh();
+			processEvents();
+			stopMeasuring();
 		}, MIN_ITERATIONS, ITERATIONS,
 				JFacePerformanceSuite.MAX_TIME);
 
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/SWTTreeTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/SWTTreeTest.java
index 427dc85..82779b7 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/SWTTreeTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/SWTTreeTest.java
@@ -21,7 +21,6 @@
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.ui.tests.performance.BasicPerformanceTest;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 public class SWTTreeTest extends BasicPerformanceTest {
 
@@ -67,17 +66,14 @@
 	public void testGetItems() throws CoreException {
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
+		exercise(() -> {
+			processEvents();
+			startMeasuring();
+			for (int j = 0; j < TreeAddTest.TEST_COUNT; j++) {
+				tree.getItems();
 				processEvents();
-				startMeasuring();
-				for (int j = 0; j < TreeAddTest.TEST_COUNT; j++) {
-					tree.getItems();
-					processEvents();
-				}
-				stopMeasuring();
 			}
+			stopMeasuring();
 		});
 
 		commitMeasurements();
@@ -93,17 +89,14 @@
 	public void testGetItemAt() throws CoreException {
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
+		exercise(() -> {
+			processEvents();
+			startMeasuring();
+			for (int j = 0; j < TreeAddTest.TEST_COUNT; j++) {
+				tree.getItem(j);
 				processEvents();
-				startMeasuring();
-				for (int j = 0; j < TreeAddTest.TEST_COUNT; j++) {
-					tree.getItem(j);
-					processEvents();
-				}
-				stopMeasuring();
 			}
+			stopMeasuring();
 		});
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ShrinkingTreeTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ShrinkingTreeTest.java
index e7de599..7889dc0 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ShrinkingTreeTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ShrinkingTreeTest.java
@@ -15,7 +15,6 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.test.performance.Dimension;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 /**
  * ShrinkingTreeTest is a test to see how long it takes to refresh a tree that goes
@@ -68,24 +67,21 @@
 	private void testRefresh(final int smallSize, final int largeSize)
 			throws CoreException {
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
+		exercise(() -> {
 
-				TestTreeElement input = new TestTreeElement(0, null);
-				viewer.setInput(input);
-				input.createChildren(largeSize);
+			TestTreeElement input = new TestTreeElement(0, null);
+			viewer.setInput(input);
+			input.createChildren(largeSize);
 
-				processEvents();
-				viewer.refresh();
-				viewer.expandAll();
-				input.createChildren(smallSize);
-				startMeasuring();
-				viewer.refresh();
+			processEvents();
+			viewer.refresh();
+			viewer.expandAll();
+			input.createChildren(smallSize);
+			startMeasuring();
+			viewer.refresh();
 
-				stopMeasuring();
+			stopMeasuring();
 
-			}
 		}, MIN_ITERATIONS, ITERATIONS, JFacePerformanceSuite.MAX_TIME);
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TableViewerRefreshTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TableViewerRefreshTest.java
index a2cf25c..6ecc610 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TableViewerRefreshTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TableViewerRefreshTest.java
@@ -22,7 +22,6 @@
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 /**
  * The TableViewerRefreshTest is a test for refreshing the TableViewer.
@@ -78,14 +77,11 @@
 	public void testRefresh() throws Throwable {
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				viewer.refresh();
-				processEvents();
-				stopMeasuring();
-			}
+		exercise(() -> {
+			startMeasuring();
+			viewer.refresh();
+			processEvents();
+			stopMeasuring();
 		}, MIN_ITERATIONS, slowGTKIterations(),
 				JFacePerformanceSuite.MAX_TIME);
 
@@ -102,14 +98,11 @@
 		openBrowser();
 		viewer.setComparator(new ViewerComparator());
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				viewer.refresh();
-				processEvents();
-				stopMeasuring();
-			}
+		exercise(() -> {
+			startMeasuring();
+			viewer.refresh();
+			processEvents();
+			stopMeasuring();
 		}, MIN_ITERATIONS, slowGTKIterations(),
 				JFacePerformanceSuite.MAX_TIME);
 
@@ -127,17 +120,14 @@
 		final ViewerComparator sorter = new ViewerComparator();
 		viewer.setComparator(sorter);
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				contentProvider.refreshElements();
-				startMeasuring();
-				contentProvider.cloneElements();
-				contentProvider.preSortElements(viewer, sorter);
-				viewer.refresh();
-				processEvents();
-				stopMeasuring();
-			}
+		exercise(() -> {
+			contentProvider.refreshElements();
+			startMeasuring();
+			contentProvider.cloneElements();
+			contentProvider.preSortElements(viewer, sorter);
+			viewer.refresh();
+			processEvents();
+			stopMeasuring();
 		}, MIN_ITERATIONS, ITERATIONS,
 				JFacePerformanceSuite.MAX_TIME);
 
@@ -153,23 +143,20 @@
 	public void testUpdate() throws Throwable {
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
+		exercise(() -> {
 
-				TableItem[] items = viewer.getTable().getItems();
-				startMeasuring();
-				for (int j = 0; j < items.length; j++) {
-					TableItem item = items[j];
-					Object element = RefreshTestContentProvider.allElements[j];
+			TableItem[] items = viewer.getTable().getItems();
+			startMeasuring();
+			for (int j = 0; j < items.length; j++) {
+				TableItem item = items[j];
+				Object element = RefreshTestContentProvider.allElements[j];
 
-					viewer.testUpdateItem(item, element);
-
-				}
-				processEvents();
-				stopMeasuring();
+				viewer.testUpdateItem(item, element);
 
 			}
+			processEvents();
+			stopMeasuring();
+
 		}, MIN_ITERATIONS, slowGTKIterations(),
 				JFacePerformanceSuite.MAX_TIME);
 
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TreeAddTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TreeAddTest.java
index 37985a5..0388ecc 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TreeAddTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TreeAddTest.java
@@ -18,7 +18,6 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.test.performance.Dimension;
-import org.eclipse.ui.tests.performance.TestRunnable;
 
 public class TreeAddTest extends TreeTest {
 
@@ -93,36 +92,32 @@
 
 		openBrowser();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
+		exercise(() -> {
 
-				TestTreeElement input = new TestTreeElement(0, null);
-				viewer.setInput(input);
-				input.createChildren(total);
-				if (preSort)
-					viewer.getSorter().sort(viewer, input.children);
-				Collection<Object> batches = new ArrayList<>();
-				int blocks = input.children.length / increment;
-				for (int j = 0; j < blocks; j = j + increment) {
-					Object[] batch = new Object[increment];
-					System.arraycopy(input.children, j * increment, batch, 0,
-							increment);
-					batches.add(batch);
-				}
-				processEvents();
-				Object[] batchArray = batches.toArray();
-				startMeasuring();
-
-				// Measure more than one for the fast cases
-				for (Object batch : batchArray) {
-					viewer.add(input, (Object[]) batch);
-					processEvents();
-				}
-
-				stopMeasuring();
-
+			TestTreeElement input = new TestTreeElement(0, null);
+			viewer.setInput(input);
+			input.createChildren(total);
+			if (preSort)
+				viewer.getSorter().sort(viewer, input.children);
+			Collection<Object> batches = new ArrayList<>();
+			int blocks = input.children.length / increment;
+			for (int j = 0; j < blocks; j = j + increment) {
+				Object[] batch1 = new Object[increment];
+				System.arraycopy(input.children, j * increment, batch1, 0, increment);
+				batches.add(batch1);
 			}
+			processEvents();
+			Object[] batchArray = batches.toArray();
+			startMeasuring();
+
+			// Measure more than one for the fast cases
+			for (Object batch2 : batchArray) {
+				viewer.add(input, (Object[]) batch2);
+				processEvents();
+			}
+
+			stopMeasuring();
+
 		}, MIN_ITERATIONS, ITERATIONS, JFacePerformanceSuite.MAX_TIME);
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/BasicPerformanceTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/BasicPerformanceTest.java
index 10f9392..b0cf2e9 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/BasicPerformanceTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/BasicPerformanceTest.java
@@ -14,9 +14,6 @@
 
 package org.eclipse.ui.tests.performance;
 
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
@@ -40,8 +37,6 @@
  */
 public abstract class BasicPerformanceTest extends UITestCase {
 
-	static final public String INTERACTIVE = "org.eclipse.ui.tests.performance.interactive";
-
 	public static final int NONE = 0;
 
 	public static final int LOCAL = 1;
@@ -56,13 +51,6 @@
 
 	final private boolean tagAsSummary;
 
-	private static long startMeasuringTime;
-
-	private static long stopMeasuringTime;
-
-	// whether we are displaying iterations per timebox in the console. default is false
-	private static boolean interactive;
-
 	public BasicPerformanceTest(String testName) {
 		this(testName, NONE);
 		Bundle bundle = FrameworkUtil.getBundle(getClass());
@@ -71,10 +59,6 @@
 			System.err.println("Unable to retrieve bundle context from BasicPerformanceTest; interactive mode is disabled");
 			return;
 		}
-		String filterString = context.getProperty(INTERACTIVE);
-		if (filterString != null && filterString.toLowerCase().equals("true")) {
-			interactive = true;
-		}
 	}
 
 	/**
@@ -107,18 +91,12 @@
 	@Override
 	protected void doSetUp() throws Exception {
 		super.doSetUp();
-		if (interactive) {
-			return;
-		}
 		tester = new PerformanceTester(this);
 	}
 
 	@Override
 	protected void doTearDown() throws Exception {
 		super.doTearDown();
-		if (interactive) {
-			return;
-		}
 		tester.dispose();
 	}
 
@@ -132,16 +110,11 @@
 	}
 
 	/**
-	 * Asserts default properties of the measurements captured for this test
-	 * case.
+	 * Asserts default properties of the measurements captured for this test case.
 	 *
-	 * @throws RuntimeException
-	 *             if the properties do not hold
+	 * @throws RuntimeException if the properties do not hold
 	 */
 	public void assertPerformance() {
-		if (interactive) {
-			return;
-		}
 		tester.assertPerformance();
 	}
 
@@ -150,30 +123,22 @@
 	 * certain range with respect to some reference value. If the specified
 	 * dimension isn't available, the call has no effect.
 	 *
-	 * @param dim
-	 *            the Dimension to check
-	 * @param lowerPercentage
-	 *            a negative number indicating the percentage the measured value
-	 *            is allowed to be smaller than some reference value
-	 * @param upperPercentage
-	 *            a positive number indicating the percentage the measured value
-	 *            is allowed to be greater than some reference value
-	 * @throws RuntimeException
-	 *             if the properties do not hold
+	 * @param dim             the Dimension to check
+	 * @param lowerPercentage a negative number indicating the percentage the
+	 *                        measured value is allowed to be smaller than some
+	 *                        reference value
+	 * @param upperPercentage a positive number indicating the percentage the
+	 *                        measured value is allowed to be greater than some
+	 *                        reference value
+	 * @throws RuntimeException if the properties do not hold
 	 */
 	public void assertPerformanceInRelativeBand(Dimension dim,
 			int lowerPercentage, int upperPercentage) {
-		if (interactive) {
-			return;
-		}
 		tester.assertPerformanceInRelativeBand(dim, lowerPercentage,
 				upperPercentage);
 	}
 
 	public void commitMeasurements() {
-		if (interactive) {
-			return;
-		}
 		tester.commitMeasurements();
 	}
 
@@ -184,18 +149,10 @@
 	 * this method or {@link PerformanceTestCase#commitMeasurements()}.
 	 */
 	public void startMeasuring() {
-		if (interactive) {
-			startMeasuringTime = System.currentTimeMillis();
-			return;
-		}
 		tester.startMeasuring();
 	}
 
 	public void stopMeasuring() {
-		if (interactive) {
-			stopMeasuringTime = System.currentTimeMillis();
-			return;
-		}
 		tester.stopMeasuring();
 	}
 
@@ -212,17 +169,11 @@
 	 */
 	private void tagAsGlobalSummary(String shortName, Dimension dimension) {
 		System.out.println("GLOBAL " + shortName);
-		if (interactive) {
-			return;
-		}
 		tester.tagAsGlobalSummary(shortName, dimension);
 	}
 
 	private void tagAsSummary(String shortName, Dimension dimension) {
 		System.out.println("LOCAL " + shortName);
-		if (interactive) {
-			return;
-		}
 		tester.tagAsSummary(shortName, dimension);
 	}
 
@@ -273,7 +224,7 @@
 	 * @param runnable
 	 * @since 3.1
 	 */
-	public static void exercise(TestRunnable runnable) throws CoreException {
+	public static void exercise(Runnable runnable) throws CoreException {
 		exercise(runnable, 3, 100, 4000);
 	}
 
@@ -286,54 +237,9 @@
 	 * @param maxTime
 	 * @since 3.1
 	 */
-	public static void exercise(TestRunnable runnable, int minIterations,
+	public static void exercise(Runnable runnable,
+			int minIterations,
 			int maxIterations, int maxTime) throws CoreException {
-		if (interactive) {
-			NumberFormat f = new DecimalFormat("##.000");
-			NumberFormat p = new DecimalFormat("#0.0");
-			try {
-				runnable.run();
-				int initialRuns = 3;
-				long startTime = System.currentTimeMillis();
-				for (int i=0; i<initialRuns; i++) {
-					runnable.run();
-				}
-				long currentTime = System.currentTimeMillis();
-				double timePerRun = (currentTime - startTime) / 1000.0 / initialRuns;
-				int totalRuns = initialRuns;
-				double interval = 10.0; // ten seconds
-				long intervalMillis = (long) (1000 * interval);
-				double averagePerInterval = interval/timePerRun;
-				System.out.println("Time per run (roughly): " + f.format(timePerRun) + " - expecting " + f.format(averagePerInterval) + " runs per 10 seconds.");
-				System.err.println("Remember - higher means faster: the following shows number of runs per interval (seconds=" + p.format(interval) + ").");
-				while (true) {
-					int numOperations = 0;
-					long elapsed = 0;
-					while (elapsed < intervalMillis) {
-						startMeasuringTime = -1;
-						stopMeasuringTime = -1;
-						startTime = System.currentTimeMillis();
-						numOperations++;
-						runnable.run();
-						currentTime = System.currentTimeMillis();
-						if (startMeasuringTime != -1 && stopMeasuringTime != -1) {
-							elapsed += stopMeasuringTime - startMeasuringTime;
-						} else {
-							elapsed += currentTime - startTime;
-						}
-					}
-					timePerRun = elapsed / 1000.0 / numOperations;
-					double operationsPerInterval = interval/timePerRun;
-					double deviation = (operationsPerInterval - averagePerInterval) / averagePerInterval * 100.0;
-					System.out.println(f.format(operationsPerInterval) + " runs/interval    (" + (deviation>=0.0?"+":"-") + p.format(Math.abs(deviation)) + "% relative to avg=" + f.format(averagePerInterval) + ")");
-					averagePerInterval = ((averagePerInterval * totalRuns) + (operationsPerInterval * numOperations)) / (totalRuns + numOperations);
-					totalRuns += numOperations;
-				}
-			} catch(Exception ex) {
-				ex.printStackTrace();
-			}
-			return;
-		}
 		long startTime = System.currentTimeMillis();
 
 		for (int counter = 0; counter < maxIterations; counter++) {
@@ -362,11 +268,6 @@
 	 *            The comment to write out for the test.
 	 */
 	public void setDegradationComment(String string) {
-		if (interactive) {
-			return;
-		}
 		tester.setDegradationComment(string);
-
 	}
-
 }
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/GenerateIdentifiersTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/GenerateIdentifiersTest.java
index 12fb308..98de433 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/GenerateIdentifiersTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/GenerateIdentifiersTest.java
@@ -33,22 +33,19 @@
 	protected void runTest() throws Throwable {
 		final IActivityManager activityManager = fWorkbench.getActivitySupport().getActivityManager();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
-				// construct the Identifiers to test
-				final String [] ids = new String[count];
-				for (int i = 0; i < ids.length; i++) {
-					long timestamp = System.currentTimeMillis();
-					ids[i] = "org.eclipse.jdt.ui/" + i + timestamp;
-				}
-
-				startMeasuring();
-				for (String id : ids) {
-					activityManager.getIdentifier(id);
-				}
-				stopMeasuring();
+		exercise(() -> {
+			// construct the Identifiers to test
+			final String[] ids = new String[count];
+			for (int i = 0; i < ids.length; i++) {
+				long timestamp = System.currentTimeMillis();
+				ids[i] = "org.eclipse.jdt.ui/" + i + timestamp;
 			}
+
+			startMeasuring();
+			for (String id : ids) {
+				activityManager.getIdentifier(id);
+			}
+			stopMeasuring();
 		});
 		commitMeasurements();
 		assertPerformance();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/LabelProviderTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/LabelProviderTest.java
index 1f57ec8..6bb0809 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/LabelProviderTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/LabelProviderTest.java
@@ -172,16 +172,13 @@
 		final Tree tree = ((TreeViewer) fViewer).getTree();
 		fShell.setFocus();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() {
-				startMeasuring();
-				for (int i = 0; i < ITEM_COUNT / 5; i++) {
-					tree.setTopItem(tree.getItem(i * 5));
-					processEvents();
-				}
-				stopMeasuring();
+		exercise(() -> {
+			startMeasuring();
+			for (int i = 0; i < ITEM_COUNT / 5; i++) {
+				tree.setTopItem(tree.getItem(i * 5));
+				processEvents();
 			}
+			stopMeasuring();
 		}, MIN_ITERATIONS, ITERATIONS, JFacePerformanceSuite.MAX_TIME);
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseEditorTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseEditorTest.java
index 33c1c83..5d66fd2 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseEditorTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseEditorTest.java
@@ -19,6 +19,7 @@
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.ide.IDE;
 
 /**
@@ -41,19 +42,21 @@
 		IWorkbenchWindow window = openTestWindow(UIPerformanceTestSetup.PERSPECTIVE1);
 		final IWorkbenchPage activePage = window.getActivePage();
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
-				startMeasuring();
-				for (int j = 0; j < 10; j++) {
-					IEditorPart part = IDE.openEditor(activePage, file, true);
-					processEvents();
-					activePage.closeEditor(part, false);
-					processEvents();
-
+		exercise(() -> {
+			startMeasuring();
+			for (int j = 0; j < 10; j++) {
+				IEditorPart part;
+				try {
+					part = IDE.openEditor(activePage, file, true);
+				} catch (PartInitException e) {
+					throw new AssertionError("Can't open editor for " + file.getName());
 				}
-				stopMeasuring();
+				processEvents();
+				activePage.closeEditor(part, false);
+				processEvents();
+
 			}
+			stopMeasuring();
 		});
 
 		tagIfNecessary("UI - Open/Close Editor", Dimension.ELAPSED_PROCESS);
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenClosePerspectiveTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenClosePerspectiveTest.java
index 5c2bb85..24619b3 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenClosePerspectiveTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenClosePerspectiveTest.java
@@ -86,19 +86,16 @@
 
 		tagIfNecessary("UI - Open/Close " + perspective1.getLabel() + " Perspective", Dimension.ELAPSED_PROCESS);
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
-				processEvents();
-				EditorTestHelper.calmDown(500, 30000, 500);
+		exercise(() -> {
+			processEvents();
+			EditorTestHelper.calmDown(500, 30000, 500);
 
-				startMeasuring();
-				activePage.setPerspective(perspective1);
-				processEvents();
-				closePerspective(activePage);
-				processEvents();
-				stopMeasuring();
-			}
+			startMeasuring();
+			activePage.setPerspective(perspective1);
+			processEvents();
+			closePerspective(activePage);
+			processEvents();
+			stopMeasuring();
 		});
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseWindowTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseWindowTest.java
index d40a51f..cdd9df0 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseWindowTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseWindowTest.java
@@ -37,19 +37,16 @@
 	protected void runTest() throws Throwable {
 		tagIfNecessary("UI - Open/Close Window", Dimension.ELAPSED_PROCESS);
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
-				processEvents();
-				EditorTestHelper.calmDown(500, 30000, 500);
+		exercise(() -> {
+			processEvents();
+			EditorTestHelper.calmDown(500, 30000, 500);
 
-				startMeasuring();
-				IWorkbenchWindow window = openTestWindow(id);
-				processEvents();
-				window.close();
-				processEvents();
-				stopMeasuring();
-			}
+			startMeasuring();
+			IWorkbenchWindow window = openTestWindow(id);
+			processEvents();
+			window.close();
+			processEvents();
+			stopMeasuring();
 		});
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/PerspectiveSwitchTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/PerspectiveSwitchTest.java
index ddd752e..3ddcd93 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/PerspectiveSwitchTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/PerspectiveSwitchTest.java
@@ -87,18 +87,15 @@
 
 		tagIfNecessary("UI - Perspective Switch", Dimension.ELAPSED_PROCESS);
 
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
-				processEvents();
+		exercise(() -> {
+			processEvents();
 
-				startMeasuring();
-				page.setPerspective(perspective1);
-				processEvents();
-				page.setPerspective(perspective2);
-				processEvents();
-				stopMeasuring();
-			}
+			startMeasuring();
+			page.setPerspective(perspective1);
+			processEvents();
+			page.setPerspective(perspective2);
+			processEvents();
+			stopMeasuring();
 		});
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ProgressReportingTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ProgressReportingTest.java
index efe8f6b..24ed1f3 100644
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ProgressReportingTest.java
+++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ProgressReportingTest.java
@@ -95,22 +95,19 @@
 	public void runAsyncTest(Runnable testContent) throws Exception {
 		final Display display = Display.getCurrent();
 		tagIfNecessary(getName(), Dimension.ELAPSED_PROCESS);
-		exercise(new TestRunnable() {
-			@Override
-			public void run() throws Exception {
-				startMeasuring();
+		exercise(() -> {
+			startMeasuring();
 
-				isDone = false;
-				testContent.run();
+			isDone = false;
+			testContent.run();
 
-				for (; !isDone;) {
-					if (!display.readAndDispatch()) {
-						display.sleep();
-					}
+			for (; !isDone;) {
+				if (!display.readAndDispatch()) {
+					display.sleep();
 				}
-
-				stopMeasuring();
 			}
+
+			stopMeasuring();
 		}, 1, MAX_ITERATIONS, MAX_RUNTIME);
 
 		commitMeasurements();
diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/TestRunnable.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/TestRunnable.java
deleted file mode 100644
index ef5693e..0000000
--- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/TestRunnable.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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.ui.tests.performance;
-
-public abstract class TestRunnable {
-	public abstract void run() throws Exception;
-}