Bug 561040 - Migrate ant tests to JUnit 4

Convert direct children of TestCase.

Change-Id: I5df6acd18a60b6f8d86172a18391f44623c9f4bc
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/formatter/XmlFormatterTest.java b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/formatter/XmlFormatterTest.java
index cf4a883..6af0c56 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/formatter/XmlFormatterTest.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/formatter/XmlFormatterTest.java
@@ -14,7 +14,7 @@
  *******************************************************************************/
 package org.eclipse.ant.tests.ui.editor.formatter;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
 import org.eclipse.ant.internal.ui.AntUIPlugin;
 import org.eclipse.ant.internal.ui.editor.formatter.FormattingPreferences;
@@ -22,9 +22,10 @@
 import org.eclipse.ant.internal.ui.preferences.AntEditorPreferenceConstants;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.junit.Test;
 
-public class XmlFormatterTest extends TestCase {
-
+public class XmlFormatterTest {
+	@Test
 	public final void testFormatUsingPreferenceStore() throws Exception {
 		IEclipsePreferences node = InstanceScope.INSTANCE.getNode(AntUIPlugin.getUniqueIdentifier());
 		if (node != null) {
@@ -38,10 +39,13 @@
 		String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
 		String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target></project>"; //$NON-NLS-1$
 		String formattedDoc = XmlFormatter.format(xmlDoc);
-		String expected = "<project default=\"go\">" + lineSep + "\t<target name=\"go\"" + lineSep + "\t        description=\"Demonstrate the wrapping of long tags.\">" + lineSep + "\t\t<echo>hi</echo>" + lineSep + "\t</target>" + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+		String expected = "<project default=\"go\">" + lineSep + "\t<target name=\"go\"" + lineSep //$NON-NLS-1$ //$NON-NLS-2$
+				+ "\t        description=\"Demonstrate the wrapping of long tags.\">" + lineSep + "\t\t<echo>hi</echo>" //$NON-NLS-1$ //$NON-NLS-2$
+				+ lineSep + "\t</target>" + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$
 		assertEquals(expected, formattedDoc);
 	}
 
+	@Test
 	public final void testFormatWithPreferenceParameter() {
 		FormattingPreferences prefs = new FormattingPreferences() {
 			@Override
@@ -72,13 +76,16 @@
 		String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
 		String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target></project>"; //$NON-NLS-1$
 		String formattedDoc = XmlFormatter.format(xmlDoc, prefs);
-		String expected = "<project default=\"go\">" + lineSep + "      <target name=\"go\"" + lineSep + "              description=\"Demonstrate the wrapping of long tags.\">" + lineSep + "            <echo>hi</echo>" + lineSep + "      </target>" + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+		String expected = "<project default=\"go\">" + lineSep + "      <target name=\"go\"" + lineSep //$NON-NLS-1$ //$NON-NLS-2$
+				+ "              description=\"Demonstrate the wrapping of long tags.\">" + lineSep //$NON-NLS-1$
+				+ "            <echo>hi</echo>" + lineSep + "      </target>" + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		assertEquals(expected, formattedDoc);
 	}
 
 	/**
 	 * Bug 84342
 	 */
+	@Test
 	public final void testFormatMaintainingLineSeparators() {
 		FormattingPreferences prefs = new FormattingPreferences() {
 			@Override
@@ -107,9 +114,12 @@
 			}
 		};
 		String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
-		String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target>" + lineSep + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$
+		String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target>" //$NON-NLS-1$
+				+ lineSep + lineSep + "</project>"; //$NON-NLS-1$
 		String formattedDoc = XmlFormatter.format(xmlDoc, prefs);
-		String expected = "<project default=\"go\">" + lineSep + "      <target name=\"go\"" + lineSep + "              description=\"Demonstrate the wrapping of long tags.\">" + lineSep + "            <echo>hi</echo>" + lineSep + "      </target>" + lineSep + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+		String expected = "<project default=\"go\">" + lineSep + "      <target name=\"go\"" + lineSep //$NON-NLS-1$ //$NON-NLS-2$
+				+ "              description=\"Demonstrate the wrapping of long tags.\">" + lineSep //$NON-NLS-1$
+				+ "            <echo>hi</echo>" + lineSep + "      </target>" + lineSep + lineSep + "</project>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		assertEquals(expected, formattedDoc);
 	}
 
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/ModelProjectTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/ModelProjectTests.java
index 693e502..aa1a9f4 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/ModelProjectTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/ModelProjectTests.java
@@ -13,11 +13,14 @@
  *******************************************************************************/
 package org.eclipse.ant.tests.ui;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Hashtable;
 import java.util.Map;
 
-import junit.framework.TestCase;
-
 import org.apache.tools.ant.AntClassLoader;
 import org.apache.tools.ant.PropertyHelper;
 import org.apache.tools.ant.Target;
@@ -25,19 +28,21 @@
 import org.apache.tools.ant.types.Path;
 import org.eclipse.ant.internal.core.IAntCoreConstants;
 import org.eclipse.ant.internal.ui.model.AntModelProject;
+import org.junit.Test;
 
 /**
  * Tests methods from {@link AntModelProject}
  * 
  * @since 3.5.1
  */
-public class ModelProjectTests extends TestCase {
+public class ModelProjectTests {
 
 	/**
 	 * Tests {@link AntModelProject#setNewProperty(String, String)}
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testsetNewProperty1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.setNewProperty("p1", "p1_value"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -51,6 +56,7 @@
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testReset1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.setDefault("foo"); //$NON-NLS-1$
@@ -65,11 +71,12 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getProperty(String)} where the property we want has been set using
-	 * {@link AntModelProject#setNewProperty(String, String)}
+	 * Tests {@link AntModelProject#getProperty(String)} where the property we want
+	 * has been set using {@link AntModelProject#setNewProperty(String, String)}
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetProprty1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.setNewProperty("testGetProprty1", "p1_value"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -77,10 +84,12 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getProperty(String)} where the property has been set into the user properties
+	 * Tests {@link AntModelProject#getProperty(String)} where the property has been
+	 * set into the user properties
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetProprty2() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.setUserProperty("testGetProprty2", "p2_value"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -88,11 +97,13 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getReference(String)} where the desired ref has been placed in the primary reference map using
+	 * Tests {@link AntModelProject#getReference(String)} where the desired ref has
+	 * been placed in the primary reference map using
 	 * {@link AntModelProject#addReference(String, Object)}
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetReference1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.addReference("testGetReference1", new Object()); //$NON-NLS-1$
@@ -100,11 +111,13 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getReference(String)} where the desired ref has been placed in the secondary 'idrefs' map using
+	 * Tests {@link AntModelProject#getReference(String)} where the desired ref has
+	 * been placed in the secondary 'idrefs' map using
 	 * {@link AntModelProject#addIdReference(String, Object)}
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetReference2() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.addIdReference("testGetReference2", new Object()); //$NON-NLS-1$
@@ -112,10 +125,12 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getReference(String)} where the desired ref is in the secondary 'idrefs' map and is an {@link UnknownElement}
+	 * Tests {@link AntModelProject#getReference(String)} where the desired ref is
+	 * in the secondary 'idrefs' map and is an {@link UnknownElement}
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetReference3() throws Exception {
 		AntModelProject p = new AntModelProject();
 		String obj = new String("hello"); //$NON-NLS-1$
@@ -129,11 +144,13 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getProperties()} such that all properties (user and 'normal') are returned in one call to
+	 * Tests {@link AntModelProject#getProperties()} such that all properties (user
+	 * and 'normal') are returned in one call to
 	 * {@link AntModelProject#getProperties()}
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetProperties1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.setProperty("p1", "p1v"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -144,17 +161,21 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#createClassLoader(org.apache.tools.ant.types.Path)} such that only one classloader is created for a given path -
-	 * classloaders are cached per-Path
+	 * Tests
+	 * {@link AntModelProject#createClassLoader(org.apache.tools.ant.types.Path)}
+	 * such that only one classloader is created for a given path - classloaders are
+	 * cached per-Path
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testCreateClassloader1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		Path path = new Path(p);
 		AntClassLoader loader = p.createClassLoader(path);
 		assertNotNull("A classloader should have been created", loader); //$NON-NLS-1$
-		// create a 'new' one, where passing null causes the classloader for the project path to be returned
+		// create a 'new' one, where passing null causes the classloader for the project
+		// path to be returned
 		AntClassLoader loader2 = p.createClassLoader(null);
 		assertNotNull("A classloader for a null path should return the project classloader", loader2); //$NON-NLS-1$
 		// pointer compare, they should reference the same class loader
@@ -162,10 +183,12 @@
 	}
 
 	/**
-	 * Tests {@link AntModelProject#getReferences()} to ensure the map returned is the live map https://bugs.eclipse.org/bugs/show_bug.cgi?id=336936
+	 * Tests {@link AntModelProject#getReferences()} to ensure the map returned is
+	 * the live map https://bugs.eclipse.org/bugs/show_bug.cgi?id=336936
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetReferences1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		p.addReference("testGetReferences1", new Object()); //$NON-NLS-1$
@@ -181,6 +204,7 @@
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testGetCopyOfReferences1() throws Exception {
 		AntModelProject p = new AntModelProject();
 		// 2 refs, ant.propertyHelper is auto-added