Convert ExpressionTestsPluginUnloading to JUnit 4.

Change-Id: Ic502c7bb713bc709f25ed7d855249628acf1ef3b
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestsPluginUnloading.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestsPluginUnloading.java
index a6b44d2..352f3fb 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestsPluginUnloading.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTestsPluginUnloading.java
@@ -10,19 +10,23 @@
  *******************************************************************************/
 package org.eclipse.core.internal.expressions.tests;
 
-import java.util.ArrayList;
-import java.util.Collections;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
+import org.junit.FixMethodOrder;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.junit.runners.MethodSorters;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 
 import org.eclipse.core.internal.expressions.ExpressionPlugin;
 import org.eclipse.core.internal.expressions.Expressions;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 
 /**
  * Tests for cache used in {@link Expressions#isInstanceOf(Object, String)}.
@@ -30,25 +34,13 @@
  * <b>WARNING:</b> These tests start, stop, and re-start the <code>com.ibm.icu</code> bundle.
  * Don't include these in another test suite!
  */
-public class ExpressionTestsPluginUnloading extends TestCase {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ExpressionTestsPluginUnloading {
 
-	public static Test suite() {
-		TestSuite suite= new TestSuite(ExpressionTestsPluginUnloading.class);
-		// ensure lexicographical ordering:
-		ArrayList<Test> tests = Collections.list(suite.tests());
-		Collections.sort(tests, (o1, o2) -> ((TestCase) o1).getName().compareTo(((TestCase) o2).getName()));
-		TestSuite result= new TestSuite();
-		for (Test test : tests) {
-			result.addTest(test);
-		}
-		return result;
-	}
+	@Rule
+	public TestName name = new TestName();
 
-	public ExpressionTestsPluginUnloading(String name) {
-		super(name);
-	}
-
-
+	@Test
 	public void test01PluginStopping() throws Exception {
 		Bundle bundle= getBundle("com.ibm.icu");
 
@@ -66,6 +58,7 @@
 		doTestInstanceofICUDecimalFormat(bundle);
 	}
 
+	@Test
 	public void test02MultipleClassloaders() throws Exception {
 		Bundle expr= getBundle("org.eclipse.core.expressions.tests");
 		Bundle icu= getBundle("com.ibm.icu");
@@ -87,8 +80,12 @@
 	private void assertInstanceOf(Object obj, String isInstance, String isNotInstance) throws Exception {
 		Class<?> clazz = obj.getClass();
 
-		System.out.println("ExpressionTestsPluginUnloading#" + getName() + "() - " + clazz.getName() + ": " + clazz.hashCode());
-		System.out.println("ExpressionTestsPluginUnloading#" + getName() + "() - ClassLoader: " + clazz.getClassLoader().hashCode());
+		System.out.println(
+				"ExpressionTestsPluginUnloading#" + name.getMethodName() + "() - " + clazz.getName() + ": "
+						+ clazz.hashCode());
+		System.out.println(
+				"ExpressionTestsPluginUnloading#" + name.getMethodName() + "() - ClassLoader: "
+						+ clazz.getClassLoader().hashCode());
 
 		for (int i= 0; i < 2; i++) { // test twice, second time is cached:
 			assertTrue(Expressions.isInstanceOf(obj, isInstance));