You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by mc...@apache.org on 2014/04/18 23:00:43 UTC

svn commit: r1588563 [7/16] - in /ant/core/trunk: ./ manual/ manual/Types/ src/etc/testcases/taskdefs/ src/etc/testcases/taskdefs/optional/ src/etc/testcases/taskdefs/optional/antlr/ src/etc/testcases/taskdefs/optional/depend/ src/etc/testcases/taskdef...

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java Fri Apr 18 21:00:38 2014
@@ -26,14 +26,28 @@ import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Project;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Testcase for the Manifest class used in the jar task.
  *
  */
-public class ManifestTest extends BuildFileTest {
+public class ManifestTest {
+    
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
     public static final String EXPANDED_MANIFEST
         = "src/etc/testcases/taskdefs/manifests/META-INF/MANIFEST.MF";
@@ -53,23 +67,23 @@ public class ManifestTest extends BuildF
 
     public static final String VALUE = "NOT_LONG";
 
-    public ManifestTest(String name) {
-        super(name);
-    }
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/manifest.xml");
+        buildRule.configureProject("src/etc/testcases/taskdefs/manifest.xml");
     }
 
+    @After
     public void tearDown() {
-        executeTarget("clean");
+        buildRule.executeTarget("clean");
     }
 
     /**
      * Empty manifest - is OK
      */
+    @Test
     public void test1() throws ManifestException, IOException {
-        executeTarget("test1");
+        buildRule.executeTarget("test1");
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         String version = manifest.getManifestVersion();
         assertEquals("Manifest was not created with correct version - ", "1.0", version);
@@ -78,8 +92,9 @@ public class ManifestTest extends BuildF
     /**
      * Simple Manifest with version 2.0
      */
+    @Test
     public void test2() throws ManifestException, IOException {
-        executeTarget("test2");
+        buildRule.executeTarget("test2");
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         String version = manifest.getManifestVersion();
         assertEquals("Manifest was not created with correct version - ", "2.0", version);
@@ -88,25 +103,36 @@ public class ManifestTest extends BuildF
     /**
      * Malformed manifest - no : on the line
      */
+    @Test
     public void test3() {
-        expectBuildExceptionContaining("test3", "Manifest is invalid - no colon on header line",
-                                       "Invalid Manifest");
+        try {
+			buildRule.executeTarget("test3");
+			fail("BuildException expected: Manifest is invalid - no colon on header line");
+		} catch (BuildException ex) {
+			assertContains("Invalid Manifest", ex.getMessage());
+		}
     }
 
     /**
      * Malformed manifest - starts with continuation line
      */
+    @Test
     public void test4() {
-        expectBuildExceptionContaining("test4", "Manifest is invalid - section starts with continuation line",
-                                       "Invalid Manifest");
+        try {
+			buildRule.executeTarget("test4");
+			fail("BuildException expected: Manifest is invalid - section starts with continuation line");
+		} catch (BuildException ex) {
+			assertContains("Invalid Manifest", ex.getMessage());
+		}
    }
 
     /**
      * Malformed manifest - Name attribute in main section
      */
+    @Test
     public void test5() {
-        executeTarget("test5");
-        String output = getLog();
+        buildRule.executeTarget("test5");
+        String output = buildRule.getLog();
         boolean hasWarning = output.indexOf("Manifest warning: \"Name\" attributes should not occur in the main section") != -1;
         assertTrue("Expected warning about Name in main section", hasWarning);
     }
@@ -114,29 +140,37 @@ public class ManifestTest extends BuildF
     /**
      * New Section not starting with Name attribute.
      */
+    @Test
     public void test6() {
-        expectBuildExceptionContaining("test6", "Manifest is invalid - section starts with incorrect attribute",
-                                       "Invalid Manifest");
-        String output = getLog();
+        try {
+			buildRule.executeTarget("test6");
+			fail("BuildException expected: Manifest is invalid - section starts with incorrect attribute");
+		} catch (BuildException ex) {
+			assertContains("Invalid Manifest", ex.getMessage());
+		}
+        String output = buildRule.getLog();
         boolean hasWarning = output.indexOf("Manifest sections should start with a \"Name\" attribute") != -1;
         assertTrue("Expected warning about section not starting with Name: attribute", hasWarning);
     }
 
+
     /**
      * From attribute is illegal
      */
+    @Test
     public void test7() {
-        executeTarget("test7");
+        buildRule.executeTarget("test7");
 
-        boolean hasWarning = getLog().indexOf(Manifest.ERROR_FROM_FORBIDDEN) != -1;
+        boolean hasWarning = buildRule.getLog().indexOf(Manifest.ERROR_FROM_FORBIDDEN) != -1;
         assertTrue("Expected warning about From: attribute", hasWarning);
     }
 
     /**
      * Inline manifest - OK
      */
+    @Test
     public void test8() throws IOException, ManifestException {
-        executeTarget("test8");
+        buildRule.executeTarget("test8");
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         Manifest.Section mainSection = manifest.getMainSection();
         String classpath = mainSection.getAttributeValue("class-path");
@@ -150,48 +184,75 @@ public class ManifestTest extends BuildF
     /**
      * Inline manifest - Invalid since has a Name attribute in the section element
      */
+    @Test
     public void test9() {
-        expectBuildExceptionContaining("test9", "Construction is invalid - Name attribute should not be used",
-                                       "Specify the section name using the \"name\" attribute of the <section> element");
+        try {
+			buildRule.executeTarget("test9");
+			fail("BuildException expected: Construction is invalid - Name attribute should not be used");
+		} catch (BuildException ex) {
+			assertContains("Specify the section name using the \"name\" attribute of the <section> element",
+                    ex.getMessage());
+		}
     }
 
     /**
      * Inline manifest - Invalid attribute without name
      */
+    @Test
     public void test10() {
-        expectBuildExceptionContaining("test10", "Attribute has no name",
-                                       "Attributes must have name and value");
+        try {
+			buildRule.executeTarget("test10");
+			fail("BuildException expected: Attribute has no name");
+		} catch (BuildException ex) {
+			assertContains("Attributes must have name and value", ex.getMessage());
+		}
     }
 
     /**
      * Inline manifest - Invalid attribute without value
      */
+    @Test
     public void test11() {
-        expectBuildExceptionContaining("test11", "Attribute has no value",
-                                       "Attributes must have name and value");
+        try {
+			buildRule.executeTarget("test11");
+			fail("BuildException expected: Attribute has no value");
+		} catch (BuildException ex) {
+			assertContains("Attributes must have name and value", ex.getMessage());
+		}
     }
 
     /**
      * Inline manifest - Invalid attribute without value
      */
+    @Test
     public void test12() {
-        expectBuildExceptionContaining("test12", "Section with no name",
-                                       "Sections must have a name");
+        try {
+			buildRule.executeTarget("test12");
+			fail("BuildException expected: Section with no name");
+		} catch (BuildException ex) {
+			assertContains("Sections must have a name", ex.getMessage());
+		}
     }
 
     /**
      * Inline manifest - Duplicate attribute
      */
+    @Test
     public void test13() {
-        expectBuildExceptionContaining("test13", "Duplicate Attribute",
-                                       "The attribute \"Test\" may not occur more than once in the same section");
+        try {
+			buildRule.executeTarget("test13");
+			fail("BuildException expected: Duplicate Attribute");
+		} catch (BuildException ex) {
+			assertContains("The attribute \"Test\" may not occur more than once in the same section", ex.getMessage());
+		}
     }
 
     /**
      * Inline manifest - OK since classpath entries can be duplicated.
      */
+    @Test
     public void test14() throws IOException, ManifestException {
-        executeTarget("test14");
+        buildRule.executeTarget("test14");
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         Manifest.Section mainSection = manifest.getMainSection();
         String classpath = mainSection.getAttributeValue("class-path");
@@ -202,14 +263,15 @@ public class ManifestTest extends BuildF
     /**
      * Tets long line wrapping
      */
+    @Test
     public void testLongLine() throws IOException, ManifestException {
-        Project p = getProject();
+        Project p = buildRule.getProject();
         p.setUserProperty("test.longline", LONG_LINE);
         p.setUserProperty("test.long68name" , LONG_68_NAME);
         p.setUserProperty("test.long70name" , LONG_70_NAME);
         p.setUserProperty("test.notlongname" , NOT_LONG_NAME);
         p.setUserProperty("test.value", VALUE);
-        executeTarget("testLongLine");
+        buildRule.executeTarget("testLongLine");
 
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         Manifest.Section mainSection = manifest.getMainSection();
@@ -247,8 +309,9 @@ public class ManifestTest extends BuildF
     /**
      * Tests ordering of sections
      */
+    @Test
     public void testOrder1() throws IOException, ManifestException {
-        executeTarget("testOrder1");
+        buildRule.executeTarget("testOrder1");
 
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         Enumeration e = manifest.getSectionNames();
@@ -270,8 +333,9 @@ public class ManifestTest extends BuildF
     /**
      * Tests ordering of sections
      */
+    @Test
     public void testOrder2() throws IOException, ManifestException {
-        executeTarget("testOrder2");
+        buildRule.executeTarget("testOrder2");
 
         Manifest manifest = getManifest(EXPANDED_MANIFEST);
         Enumeration e = manifest.getSectionNames();
@@ -293,15 +357,22 @@ public class ManifestTest extends BuildF
     /**
      * file attribute for manifest task is required.
      */
+    @Test
     public void testNoFile() {
-        expectBuildException("testNoFile", "file is required");
+        try {
+			buildRule.executeTarget("testNoFile");
+			fail("BuildException expected: file is required");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
     /**
      * replace changes Manifest-Version from 2.0 to 1.0
      */
+    @Test
     public void testReplace() throws IOException, ManifestException {
-        executeTarget("testReplace");
+        buildRule.executeTarget("testReplace");
         Manifest mf = getManifest("src/etc/testcases/taskdefs/mftest.mf");
         assertNotNull(mf);
         assertEquals(Manifest.getDefaultManifest(), mf);
@@ -310,8 +381,9 @@ public class ManifestTest extends BuildF
     /**
      * update keeps the Manifest-Version and adds a new attribute Foo
      */
+    @Test
     public void testUpdate() throws IOException, ManifestException {
-        executeTarget("testUpdate");
+        buildRule.executeTarget("testUpdate");
         Manifest mf = getManifest("src/etc/testcases/taskdefs/mftest.mf");
         assertNotNull(mf);
         assertTrue(!Manifest.getDefaultManifest().equals(mf));
@@ -328,28 +400,60 @@ public class ManifestTest extends BuildF
         assertTrue(mfAsString.indexOf("Foo: Baz") > -1);
     }
 
+    @Test
     public void testFrom() {
-        expectLogContaining("testFrom", Manifest.ERROR_FROM_FORBIDDEN);
+        buildRule.executeTarget("testFrom");
+		assertContains(Manifest.ERROR_FROM_FORBIDDEN, buildRule.getLog());
     }
 
+    @Test
     public void testIllegalName() {
-        expectBuildException("testIllegalName", "Manifest attribute names must not contain ' '");
+        try {
+			buildRule.executeTarget("testIllegalName");
+			fail("BuildException expected: Manifest attribute names must not contain ' '");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void testIllegalNameInSection() {
-        expectBuildException("testIllegalNameInSection", "Manifest attribute names must not contain ' '");
+        try {
+			buildRule.executeTarget("testIllegalNameInSection");
+			fail("BuildException expected: Manifest attribute names must not contain ' '");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void testIllegalNameBegin() {
-        expectBuildException("testIllegalNameInSection", "Manifest attribute names must not start with '-' at the begin.");
+        try {
+			buildRule.executeTarget("testIllegalNameInSection");
+			fail("BuildException expected: Manifest attribute names must not start with '-' at the begin.");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void testIllegalName2() {
-        expectBuildException("testIllegalName", "Manifest attribute names must not contain '.'");
+        try {
+			buildRule.executeTarget("testIllegalName");
+			fail("BuildException expected: Manifest attribute names must not contain '.'");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void testIllegalName3() {
-        expectBuildException("testIllegalName", "Manifest attribute names must not contain '*'");
+        try {
+			buildRule.executeTarget("testIllegalName");
+			fail("BuildException expected: Manifest attribute names must not contain '*'");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
     /**

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java Fri Apr 18 21:00:38 2014
@@ -17,31 +17,50 @@
  */
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
 
 /**
  */
-public class MkdirTest extends BuildFileTest {
+public class MkdirTest {
 
-    public MkdirTest(String name) {
-        super(name);
-    }
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/mkdir.xml");
+        buildRule.configureProject("src/etc/testcases/taskdefs/mkdir.xml");
     }
 
+    @Test
     public void test1() {
-        expectBuildException("test1", "required argument missing");
+        try {
+			buildRule.executeTarget("test1");
+			fail("BuildException expected: required argument missing");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test2() {
-        expectBuildException("test2", "directory already exists as a file");
+        try {
+			buildRule.executeTarget("test2");
+			fail("BuildException expected: directory already exists as a file");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test3() {
-        executeTarget("test3");
-        java.io.File f = new java.io.File(getOutputDir(), "testdir.tmp");
+        buildRule.executeTarget("test3");
+        java.io.File f = new java.io.File(buildRule.getProject().getProperty("output"), "testdir.tmp");
         if (!f.exists() || !f.isDirectory()) {
             fail("mkdir failed");
         } else {

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java Fri Apr 18 21:00:38 2014
@@ -18,126 +18,151 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
-import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.FileUtilities;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
 import java.io.File;
 import java.io.IOException;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 /**
  * Tests the Move task.
  *
  */
-public class MoveTest extends BuildFileTest {
-
-    /** Utilities used for file operations */
-    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-
-    public MoveTest(String name) {
-        super(name);
-    }
+public class MoveTest {
+    
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/move.xml");
-        project.executeTarget("setUp");
+        buildRule.configureProject("src/etc/testcases/taskdefs/move.xml");
+        buildRule.executeTarget("setUp");
     }
 
+    @Test
     public void testFilterSet() throws IOException {
-        executeTarget("testFilterSet");
-        File tmp  = new File(getOutputDir(), "move.filterset.tmp");
-        File check  = new File(getProjectDir(), "expected/copy.filterset.filtered");
+        buildRule.executeTarget("testFilterSet");
+        File tmp  = new File(buildRule.getProject().getProperty("output"), "move.filterset.tmp");
+        File check  = new File(buildRule.getProject().getBaseDir(), "expected/copy.filterset.filtered");
         assertTrue(tmp.exists());
-        assertTrue(FILE_UTILS.contentEquals(tmp, check));
+        assertEquals(FileUtilities.getFileContents(check), FileUtilities.getFileContents(tmp));
     }
 
+    @Test
     public void testFilterChain() throws IOException {
-        executeTarget("testFilterChain");
-        File tmp  = new File(getOutputDir(), "move.filterchain.tmp");
-        File check  = new File(getProjectDir(), "expected/copy.filterset.filtered");
+        buildRule.executeTarget("testFilterChain");
+        File tmp  = new File(buildRule.getProject().getProperty("output"), "move.filterchain.tmp");
+        File check  = new File(buildRule.getProject().getBaseDir(), "expected/copy.filterset.filtered");
         assertTrue(tmp.exists());
-        assertTrue(FILE_UTILS.contentEquals(tmp, check));
+        assertEquals(FileUtilities.getFileContents(check), FileUtilities.getFileContents(tmp));
     }
 
     /** Bugzilla Report 11732 */
+    @Test
     public void testDirectoryRemoval() throws IOException {
-        executeTarget("testDirectoryRemoval");
-        assertTrue(!new File(getOutputDir(),"E/B/1").exists());
-        assertTrue(new File(getOutputDir(),"E/C/2").exists());
-        assertTrue(new File(getOutputDir(),"E/D/3").exists());
-        assertTrue(new File(getOutputDir(),"A/B/1").exists());
-        assertTrue(!new File(getOutputDir(),"A/C/2").exists());
-        assertTrue(!new File(getOutputDir(),"A/D/3").exists());
-        assertTrue(!new File(getOutputDir(),"A/C").exists());
-        assertTrue(!new File(getOutputDir(),"A/D").exists());
+
+        buildRule.executeTarget("testDirectoryRemoval");
+        String output = buildRule.getProject().getProperty("output");
+        assertTrue(!new File(output,"E/B/1").exists());
+        assertTrue(new File(output, "E/C/2").exists());
+        assertTrue(new File(output,"E/D/3").exists());
+        assertTrue(new File(output,"A/B/1").exists());
+        assertTrue(!new File(output,"A/C/2").exists());
+        assertTrue(!new File(output,"A/D/3").exists());
+        assertTrue(!new File(output,"A/C").exists());
+        assertTrue(!new File(output,"A/D").exists());
     }
 
     /** Bugzilla Report 18886 */
+    @Test
     public void testDirectoryRetaining() throws IOException {
-        executeTarget("testDirectoryRetaining");
-        assertTrue(new File(getOutputDir(),"E").exists());
-        assertTrue(new File(getOutputDir(),"E/1").exists());
-        assertTrue(!new File(getOutputDir(),"A/1").exists());
-        assertTrue(new File(getOutputDir(),"A").exists());
+        buildRule.executeTarget("testDirectoryRetaining");
+        String output = buildRule.getProject().getProperty("output");
+        assertTrue(new File(output,"E").exists());
+        assertTrue(new File(output,"E/1").exists());
+        assertTrue(!new File(output,"A/1").exists());
+        assertTrue(new File(output,"A").exists());
     }
 
+    @Test
     public void testCompleteDirectoryMove() throws IOException {
         testCompleteDirectoryMove("testCompleteDirectoryMove");
     }
 
+    @Test
     public void testCompleteDirectoryMove2() throws IOException {
         testCompleteDirectoryMove("testCompleteDirectoryMove2");
     }
 
     private void testCompleteDirectoryMove(String target) throws IOException {
-        executeTarget(target);
-        assertTrue(new File(getOutputDir(),"E").exists());
-        assertTrue(new File(getOutputDir(),"E/1").exists());
-        assertTrue(!new File(getOutputDir(),"A/1").exists());
+        buildRule.executeTarget(target);
+        String output = buildRule.getProject().getProperty("output");
+        assertTrue(new File(output,"E").exists());
+        assertTrue(new File(output,"E/1").exists());
+        assertTrue(!new File(output,"A/1").exists());
         // <path> swallows the basedir, it seems
         //assertTrue(!new File(getOutputDir(),"A").exists());
     }
 
+    @Test
     public void testPathElementMove() throws IOException {
-        executeTarget("testPathElementMove");
-        assertTrue(new File(getOutputDir(),"E").exists());
-        assertTrue(new File(getOutputDir(),"E/1").exists());
-        assertTrue(!new File(getOutputDir(),"A/1").exists());
-        assertTrue(new File(getOutputDir(),"A").exists());
+        buildRule.executeTarget("testPathElementMove");
+        String output = buildRule.getProject().getProperty("output");
+        assertTrue(new File(output,"E").exists());
+        assertTrue(new File(output,"E/1").exists());
+        assertTrue(!new File(output,"A/1").exists());
+        assertTrue(new File(output,"A").exists());
     }
 
+    @Test
     public void testMoveFileAndFileset() {
-        executeTarget("testMoveFileAndFileset");
+        buildRule.executeTarget("testMoveFileAndFileset");
     }
 
+    @Test
     public void testCompleteDirectoryMoveToExistingDir() {
-        executeTarget("testCompleteDirectoryMoveToExistingDir");
+        buildRule.executeTarget("testCompleteDirectoryMoveToExistingDir");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileToFile() {
-        executeTarget("testCompleteDirectoryMoveFileToFile");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileToFile");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileToDir() {
-        executeTarget("testCompleteDirectoryMoveFileToDir");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileToDir");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileAndFileset() {
-        executeTarget("testCompleteDirectoryMoveFileAndFileset");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileAndFileset");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileToExistingFile() {
-        executeTarget("testCompleteDirectoryMoveFileToExistingFile");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileToExistingFile");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileToExistingDir() {
-        executeTarget("testCompleteDirectoryMoveFileToExistingDir");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileToExistingDir");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileToDirWithExistingFile() {
-        executeTarget("testCompleteDirectoryMoveFileToDirWithExistingFile");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileToDirWithExistingFile");
     }
 
+    @Test
     public void testCompleteDirectoryMoveFileToDirWithExistingDir() {
-        executeTarget("testCompleteDirectoryMoveFileToDirWithExistingDir");
+        buildRule.executeTarget("testCompleteDirectoryMoveFileToDirWithExistingDir");
     }
 
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java Fri Apr 18 21:00:38 2014
@@ -18,44 +18,53 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.util.FileNameMapper;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
 
 
 /**
  */
-public class MultiMapTest extends BuildFileTest {
-
-    public MultiMapTest(String name) {
-        super(name);
-    }
+public class MultiMapTest {
+    
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/multimap.xml");
+        buildRule.configureProject("src/etc/testcases/taskdefs/multimap.xml");
     }
 
+    @Test
     public void testMultiCopy() {
-        executeTarget("multicopy");
+        buildRule.executeTarget("multicopy");
     }
 
+    @Test
     public void testMultiMove() {
-        executeTarget("multimove");
+        buildRule.executeTarget("multimove");
     }
 
+    @Test
     public void testSingleCopy() {
-        executeTarget("singlecopy");
+        buildRule.executeTarget("singlecopy");
     }
 
+    @Test
     public void testSingleMove() {
-        executeTarget("singlemove");
+        buildRule.executeTarget("singlemove");
     }
 
+    @Test
     public void testCopyWithEmpty() {
-        executeTarget("copywithempty");
+        buildRule.executeTarget("copywithempty");
     }
 
+    @Test
     public void testMoveWithEmpty() {
-        executeTarget("movewithempty");
+        buildRule.executeTarget("movewithempty");
     }
 
     public static class TestMapper implements FileNameMapper {

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java Fri Apr 18 21:00:38 2014
@@ -18,45 +18,66 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.fail;
 
 /**
  * test nice
  */
-public class NiceTest extends BuildFileTest {
+public class NiceTest {
 
-    public NiceTest(String name) {
-        super(name);
-    }
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/nice.xml");
+        buildRule.configureProject("src/etc/testcases/taskdefs/nice.xml");
     }
 
+    @Test
     public void testNoop() {
-        executeTarget("noop");
+        buildRule.executeTarget("noop");
     }
 
+    @Test
     public void testCurrent() {
-        executeTarget("current");
+        buildRule.executeTarget("current");
     }
 
+    @Test
     public void testFaster() {
-        executeTarget("faster");
+        buildRule.executeTarget("faster");
     }
 
+    @Test
     public void testSlower() {
-        executeTarget("slower");
+        buildRule.executeTarget("slower");
     }
 
+    @Test
     public void testTooSlow() {
-        expectBuildExceptionContaining(
-                "too_slow","out of range","out of the range 1-10");
+        try {
+			buildRule.executeTarget("too_slow");
+			fail("BuildException expected: out of range");
+		} catch (BuildException ex) {
+			assertContains("out of the range 1-10", ex.getMessage());
+		}
     }
 
+    @Test
     public void testTooFast() {
-        expectBuildExceptionContaining(
-                "too_fast", "out of range", "out of the range 1-10");
+        try {
+			buildRule.executeTarget("too_fast");
+			fail("BuildException expected: out of range");
+		} catch (BuildException ex) {
+			assertContains("out of the range 1-10", ex.getMessage());
+		}
     }
 
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java Fri Apr 18 21:00:38 2014
@@ -19,19 +19,26 @@ package org.apache.tools.ant.taskdefs;
 
 import java.io.PrintStream;
 
-import junit.framework.AssertionFailedError;
-
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.DemuxOutputStream;
 import org.apache.tools.ant.ExitStatusException;
 import org.apache.tools.ant.Project;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 /**
  * Test of the parallel TaskContainer
- *
- * @created 21 February 2002
  */
-public class ParallelTest extends BuildFileTest {
+public class ParallelTest {
+
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
+
     /** Standard property value for the basic test */
     public final static String DIRECT_MESSAGE = "direct";
     /** Standard property value for the basic and fail test */
@@ -43,41 +50,40 @@ public class ParallelTest extends BuildF
     public final static String TEST_BUILD_FILE
          = "src/etc/testcases/taskdefs/parallel.xml";
 
-    /**
-     * Constructor for the ParallelTest object
-     *
-     * @param name name of the test
-     */
-    public ParallelTest(String name) {
-        super(name);
-    }
 
     /** The JUnit setup method */
+    @Before
     public void setUp() {
-        configureProject(TEST_BUILD_FILE);
+        buildRule.configureProject(TEST_BUILD_FILE);
     }
 
     /** tests basic operation of the parallel task */
+    @Test
     public void testBasic() {
         // should get no output at all
-        Project p = getProject();
+        Project p = buildRule.getProject();
         p.setUserProperty("test.direct", DIRECT_MESSAGE);
         p.setUserProperty("test.delayed", DELAYED_MESSAGE);
-        expectOutputAndError("testBasic", "", "");
-        String log = getLog();
+        buildRule.executeTarget("testBasic");
+        assertEquals("", buildRule.getOutput());
+        assertEquals("", buildRule.getError());
+        String log = buildRule.getLog();
         assertEquals("parallel tasks didn't output correct data", log,
             DIRECT_MESSAGE + DELAYED_MESSAGE);
 
     }
 
     /** tests basic operation of the parallel task */
+    @Test
     public void testThreadCount() {
         // should get no output at all
-        Project p = getProject();
+        Project p = buildRule.getProject();
         p.setUserProperty("test.direct", DIRECT_MESSAGE);
         p.setUserProperty("test.delayed", DELAYED_MESSAGE);
-        expectOutputAndError("testThreadCount", "", "");
-        String log = getLog();
+        buildRule.executeTarget("testThreadCount");
+        assertEquals("", buildRule.getOutput());
+        assertEquals("", buildRule.getError());
+        String log = buildRule.getLog();
         int pos = 0;
         while (pos > -1) {
             pos = countThreads(log, pos);
@@ -89,9 +95,8 @@ public class ParallelTest extends BuildF
      * <code>^(\|\d+\/(+-)*)+\|$</code> for someting like
      * <code>|3/++--+-|5/+++++-----|</code>
      *
-     *@returns -1 no more tests
+     *@return -1 no more tests
      *          # start pos of next test
-     *@throws AssertionFailedException when a constraint is invalid
      */
     static int countThreads(String s, int start) {
         int firstPipe = s.indexOf('|', start);
@@ -113,12 +118,12 @@ public class ParallelTest extends BuildF
                     current--;
                     break;
                 default:
-                    throw new AssertionFailedError("Only expect '+-' in result count, found "
-                        + s.charAt(--pos) + " at position " + pos);
+                    fail("Only expect '+-' in result count, found "
+                            + s.charAt(--pos) + " at position " + pos);
             }
             if (current > max) {
-                throw new AssertionFailedError("Number of executing threads exceeded number allowed: "
-                    + current + " > " + max);
+                fail("Number of executing threads exceeded number allowed: "
+                        + current + " > " + max);
             }
         }
         return lastPipe;
@@ -126,38 +131,48 @@ public class ParallelTest extends BuildF
 
 
     /** tests the failure of a task within a parallel construction */
+    @Test
     public void testFail() {
         // should get no output at all
-        Project p = getProject();
+        Project p = buildRule.getProject();
         p.setUserProperty("test.failure", FAILURE_MESSAGE);
         p.setUserProperty("test.delayed", DELAYED_MESSAGE);
-        expectBuildExceptionContaining("testFail",
-            "fail task in one parallel branch", FAILURE_MESSAGE);
+        try {
+            buildRule.executeTarget("testFail");
+            fail("fail task in one parallel branch");
+        } catch (BuildException ex) {
+            assertEquals(FAILURE_MESSAGE, ex.getMessage());
+        }
     }
 
     /** tests the demuxing of output streams in a multithreaded situation */
+    @Test
     public void testDemux() {
-        Project p = getProject();
+        Project p = buildRule.getProject();
         p.addTaskDefinition("demuxtest", DemuxOutputTask.class);
-        PrintStream out = System.out;
-        PrintStream err = System.err;
-        System.setOut(new PrintStream(new DemuxOutputStream(p, false)));
-        System.setErr(new PrintStream(new DemuxOutputStream(p, true)));
-
-        try {
-            p.executeTarget("testDemux");
-        } finally {
-            System.setOut(out);
-            System.setErr(err);
+        synchronized (System.out) {
+            PrintStream out = System.out;
+            PrintStream err = System.err;
+            System.setOut(new PrintStream(new DemuxOutputStream(p, false)));
+            System.setErr(new PrintStream(new DemuxOutputStream(p, true)));
+
+            try {
+                p.executeTarget("testDemux");
+            } finally {
+                System.setOut(out);
+                System.setErr(err);
+            }
         }
     }
 
     /**
      * @see "https://issues.apache.org/bugzilla/show_bug.cgi?id=55539"
      */
+    @Test
     public void testSingleExit() {
         try {
-            executeTarget("testSingleExit");
+            buildRule.executeTarget("testSingleExit");
+            fail("ExitStatusException should have been thrown");
         } catch (ExitStatusException ex) {
             assertEquals(42, ex.getStatus());
         }
@@ -166,9 +181,11 @@ public class ParallelTest extends BuildF
     /**
      * @see "https://issues.apache.org/bugzilla/show_bug.cgi?id=55539"
      */
+    @Test
     public void testExitAndOtherException() {
         try {
-            executeTarget("testExitAndOtherException");
+            buildRule.executeTarget("testExitAndOtherException");
+            fail("ExitStatusException should have been thrown");
         } catch (ExitStatusException ex) {
             assertEquals(42, ex.getStatus());
         }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java Fri Apr 18 21:00:38 2014
@@ -18,39 +18,48 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
 
 /**
  * Unit test for the &lt;pathconvert&gt; task.
  */
-public class PathConvertTest extends BuildFileTest {
+public class PathConvertTest {
+
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
+
     private static final String BUILD_PATH = "src/etc/testcases/taskdefs/";
     private static final String BUILD_FILENAME = "pathconvert.xml";
     private static final String BUILD_FILE = BUILD_PATH + BUILD_FILENAME;
     
-    public PathConvertTest(String name) {
-        super(name);
-    }
-
+    @Before
     public void setUp() {
-        configureProject(BUILD_FILE);
+        buildRule.configureProject(BUILD_FILE);
     }
 
+    @Test
     public void testMap() {
         test("testmap");
     }
 
+    @Test
     public void testMapper() {
         test("testmapper");
     }
 
+    @Test
     public void testNoTargetOs() {
-        executeTarget("testnotargetos");
+        buildRule.executeTarget("testnotargetos");
     }
 
     private void test(String target) {
-        executeTarget(target);
-        assertPropertyEquals("result", "test#" + BUILD_FILENAME);
+        buildRule.executeTarget(target);
+        assertEquals("test#" + BUILD_FILENAME, buildRule.getProject().getProperty("result"));
     }
 
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java Fri Apr 18 21:00:38 2014
@@ -19,70 +19,107 @@
 package org.apache.tools.ant.taskdefs;
 
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.FileSet;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 /**
  */
-public class PreSetDefTest extends BuildFileTest {
-    public PreSetDefTest(String name) {
-        super(name);
-    }
-
+public class PreSetDefTest {
+    
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
+    
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/presetdef.xml");
+        buildRule.configureProject("src/etc/testcases/taskdefs/presetdef.xml");
     }
 
+    @Test
     public void testSimple() {
-        expectLog("simple", "Hello world");
+        buildRule.executeTarget("simple");
+		assertEquals("Hello world", buildRule.getLog());
     }
 
+    @Test
     public void testText() {
-        expectLog("text", "Inner Text");
+        buildRule.executeTarget("text");
+		assertEquals("Inner Text", buildRule.getLog());
     }
 
+    @Test
     public void testUri() {
-        expectLog("uri", "Hello world");
+        buildRule.executeTarget("uri");
+		assertEquals("Hello world", buildRule.getLog());
     }
 
+    @Test
     public void testDefaultTest() {
-        expectLog("defaulttest", "attribute is false");
+        buildRule.executeTarget("defaulttest");
+		assertEquals("attribute is false", buildRule.getLog());
     }
 
+    @Test
     public void testDoubleDefault() {
-        expectLog("doubledefault", "attribute is falseattribute is true");
+        buildRule.executeTarget("doubledefault");
+		assertEquals("attribute is falseattribute is true", buildRule.getLog());
     }
 
+    @Test
     public void testTextOptional() {
-        expectLog("text.optional", "MyTextoverride text");
+        buildRule.executeTarget("text.optional");
+		assertEquals("MyTextoverride text", buildRule.getLog());
     }
 
+    @Test
     public void testElementOrder() {
-        expectLog("element.order", "Line 1Line 2");
+        buildRule.executeTarget("element.order");
+		assertEquals("Line 1Line 2", buildRule.getLog());
     }
 
+    @Test
     public void testElementOrder2() {
-        expectLog("element.order2", "Line 1Line 2Line 3");
+        buildRule.executeTarget("element.order2");
+		assertEquals("Line 1Line 2Line 3", buildRule.getLog());
     }
 
+    @Test
     public void testAntTypeTest() {
-        expectLog("antTypeTest", "");
+        buildRule.executeTarget("antTypeTest");
+		assertEquals("", buildRule.getLog());
     }
 
+    @Test
     public void testCorrectTaskNameBadAttr() {
-        expectBuildExceptionContaining(
-            "correct_taskname_badattr", "attribute message", "javac doesn't support the");
+        try {
+            buildRule.executeTarget("correct_taskname_badattr");
+            fail("BuildException expected: attribute message");
+        } catch (BuildException ex) {
+            assertContains("javac doesn't support the", ex.getMessage());
+        }
     }
 
+    @Test
     public void testCorrectTaskNameBadEl() {
-        expectBuildExceptionContaining(
-            "correct_taskname_badel", "element message", "javac doesn't support the");
+        try {
+            buildRule.executeTarget("correct_taskname_badel");
+            fail("BuildException expected: element message");
+        } catch (BuildException ex) {
+            assertContains("javac doesn't support the", ex.getMessage());
+        }
     }
     
+    @Test
     public void testPresetdefWithNestedElementTwice() { // #38056
-        executeTarget("presetdef-with-nested-element-twice");
-        executeTarget("presetdef-with-nested-element-twice");
+        buildRule.executeTarget("presetdef-with-nested-element-twice");
+        buildRule.executeTarget("presetdef-with-nested-element-twice");
     }
     
     /**

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProcessDestroyerTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProcessDestroyerTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProcessDestroyerTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProcessDestroyerTest.java Fri Apr 18 21:00:38 2014
@@ -23,57 +23,46 @@ package org.apache.tools.ant.taskdefs;
 
 import java.io.IOException;
 
+import org.junit.Test;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 /**
  */
-public class ProcessDestroyerTest extends TestCase {
+//TODO this test seems really unsafe due to the infinite loop
+public class ProcessDestroyerTest {
 
-    /**
-     * Constructor for ProcessDestroyerTest.
-     * @param arg0
-     */
-    public ProcessDestroyerTest(String arg0) {
-        super(arg0);
-    }
+    @Test
+    public void testProcessDestroyer() throws IOException {
+        ProcessDestroyer processDestroyer = new ProcessDestroyer();
+        Process process =
+            Runtime.getRuntime().exec(
+                "java -cp "
+                    + System.getProperty("java.class.path")
+                    + " "
+                    + getClass().getName());
+
+        assertFalse("Not registered as shutdown hook",
+                    processDestroyer.isAddedAsShutdownHook());
+
+        processDestroyer.add(process);
 
-    public void testProcessDestroyer(){
+        assertTrue("Registered as shutdown hook",
+                   processDestroyer.isAddedAsShutdownHook());
         try {
-            ProcessDestroyer processDestroyer = new ProcessDestroyer();
-            Process process =
-                Runtime.getRuntime().exec(
-                    "java -cp "
-                        + System.getProperty("java.class.path")
-                        + " "
-                        + getClass().getName());
-
-            assertFalse("Not registered as shutdown hook",
-                        processDestroyer.isAddedAsShutdownHook());
-
-            processDestroyer.add(process);
-
-            assertTrue("Registered as shutdown hook",
-                       processDestroyer.isAddedAsShutdownHook());
-            try {
-                process.destroy();
-            } finally {
-                processDestroyer.remove(process);
-            }
-
-            assertFalse("Not registered as shutdown hook",
-                        processDestroyer.isAddedAsShutdownHook());
-        } catch (IOException e) {
-            e.printStackTrace();
+            process.destroy();
+        } finally {
+            processDestroyer.remove(process);
         }
+
+        assertFalse("Not registered as shutdown hook",
+                    processDestroyer.isAddedAsShutdownHook());
+
     }
 
-    public static void main(String[] args){
-        new ProcessDestroyerTest("testProcessDestroyer").testProcessDestroyer();
-        try{
-            Thread.sleep(60000);
-        }catch(InterruptedException ie){
-            ie.printStackTrace();
-        }
+    public static void main(String[] args) throws IOException, InterruptedException {
+        new ProcessDestroyerTest().testProcessDestroyer();
+        Thread.sleep(60000);
     }
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java Fri Apr 18 21:00:38 2014
@@ -18,106 +18,124 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.util.FileUtils;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
 
 /**
  */
-public class PropertyTest extends BuildFileTest {
+public class PropertyTest {
+	
+	@Rule
+	public BuildFileRule buildRule = new BuildFileRule();
 
     /** Utilities used for file operations */
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
 
-    public PropertyTest(String name) {
-        super(name);
-    }
-
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/property.xml");
-        project.executeTarget("setUp");
+        buildRule.configureProject("src/etc/testcases/taskdefs/property.xml");
+        buildRule.executeTarget("setUp");
     }
 
+    @Test
     public void test1() {
         // should get no output at all
-        expectOutputAndError("test1", "", "");
+    	buildRule.executeTarget("test1");
+    	assertEquals("System output should have been empty", "", buildRule.getOutput());
+    	assertEquals("System error should have been empty", "", buildRule.getError());
     }
 
+    @Test
     public void test2() {
-        expectLog("test2", "testprop1=aa, testprop3=xxyy, testprop4=aazz");
+    	buildRule.executeTarget("test2");
+        assertContains("testprop1=aa, testprop3=xxyy, testprop4=aazz", buildRule.getLog());
     }
 
+    @Test
     public void test3() {
         try {
-            executeTarget("test3");
+            buildRule.executeTarget("test3");
+            fail("Did not throw exception on circular exception");
         }
         catch (BuildException e) {
             assertTrue("Circular definition not detected - ",
                      e.getMessage().indexOf("was circularly defined") != -1);
-            return;
         }
-        fail("Did not throw exception on circular exception");
+        
     }
 
+    @Test
     public void test4() {
-        expectLog("test4", "http.url is http://localhost:999");
+    	buildRule.executeTarget("test4");
+    	assertContains("http.url is http://localhost:999", buildRule.getLog());
     }
 
+    @Test
     public void test5() {
-        String baseDir = getProject().getProperty("basedir");
-        try {
-            String uri = FILE_UTILS.toURI(
-                baseDir + "/property3.properties");
-            getProject().setNewProperty(
-                "test5.url", uri);
-        } catch (Exception ex) {
-            throw new BuildException(ex);
-        }
-        expectLog("test5", "http.url is http://localhost:999");
+        String baseDir = buildRule.getProject().getProperty("basedir");
+    	String uri = FILE_UTILS.toURI(baseDir + "/property3.properties");
+        buildRule.getProject().setNewProperty("test5.url", uri);
+        
+        buildRule.executeTarget("test5");
+        assertContains("http.url is http://localhost:999", buildRule.getLog());
     }
 
+    @Test
     public void testPrefixSuccess() {
-        executeTarget("prefix.success");
-        assertEquals("80", project.getProperty("server1.http.port"));
+        buildRule.executeTarget("prefix.success");
+        assertEquals("80", buildRule.getProject().getProperty("server1.http.port"));
     }
 
+    @Test
     public void testPrefixFailure() {
        try {
-            executeTarget("prefix.fail");
+            buildRule.executeTarget("prefix.fail");
+            fail("Did not throw exception on invalid use of prefix");
         }
         catch (BuildException e) {
-            assertTrue("Prefix allowed on non-resource/file load - ", 
-                     e.getMessage().indexOf("Prefix is only valid") != -1);
-            return;
+            assertContains("Prefix allowed on non-resource/file load - ", 
+                     "Prefix is only valid", e.getMessage());
         }
-        fail("Did not throw exception on invalid use of prefix");
     }
 
+    @Test
     public void testCircularReference() {
         try {
-            executeTarget("testCircularReference");
+            buildRule.executeTarget("testCircularReference");
+            fail("Did not throw exception on circular exception");
         } catch (BuildException e) {
-            assertTrue("Circular definition not detected - ",
-                         e.getMessage().indexOf("was circularly defined")
-                         != -1);
-            return;
+            assertContains("Circular definition not detected - ",
+                         "was circularly defined", e.getMessage());
         }
-        fail("Did not throw exception on circular exception");
     }
 
+    @Test
     public void testThisIsNotACircularReference() {
-        expectLog("thisIsNotACircularReference", "b is A/A/A");
+    	buildRule.executeTarget("thisIsNotACircularReference");
+        assertContains("b is A/A/A", buildRule.getLog());
     }
     
+    @Test
     public void testXmlProperty() {
         try {
             Class.forName("java.lang.Iterable");
-            executeTarget("testXmlProperty");
-            assertEquals("ONE", project.getProperty("xml.one"));
-            assertEquals("TWO", project.getProperty("xml.two"));
         } catch (ClassNotFoundException e) {
-            // Xml-Loading only on Java5+
+        	Assume.assumeNoException("XML Loading only on Java 5+", e);
         }
+        buildRule.executeTarget("testXmlProperty");
+        assertEquals("ONE", buildRule.getProject().getProperty("xml.one"));
+        assertEquals("TWO", buildRule.getProject().getProperty("xml.two"));
+        
     }
 
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java Fri Apr 18 21:00:38 2014
@@ -21,26 +21,35 @@ package org.apache.tools.ant.taskdefs;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import org.apache.tools.ant.BuildFileTest;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  */
-public class ProtectedJarMethodsTest extends BuildFileTest {
+public class ProtectedJarMethodsTest {
 
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
     private static String tempJar = "tmp.jar";
 
-    public ProtectedJarMethodsTest(String name) {
-        super(name);
-    }
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/jar.xml");
-        executeTarget("setUp");
+        buildRule.configureProject("src/etc/testcases/taskdefs/jar.xml");
+        buildRule.executeTarget("setUp");
     }
 
+    @Test
     public void testGrabFilesAndDirs() throws IOException {
-        executeTarget("testIndexTests");
-        String archive = getProject().getProperty(tempJar);
+        buildRule.executeTarget("testIndexTests");
+        String archive = buildRule.getProject().getProperty(tempJar);
         ArrayList dirs = new ArrayList();
         ArrayList files = new ArrayList();
         String[] expectedDirs = new String[] {
@@ -63,16 +72,19 @@ public class ProtectedJarMethodsTest ext
         }
     }
 
+    @Test
     public void testFindJarNameNoClasspath() {
         assertEquals("foo", Jar.findJarName("foo", null));
         assertEquals("foo", Jar.findJarName("lib" + File.separatorChar + "foo",
                                             null));
     }
 
+    @Test
     public void testFindJarNameNoMatch() {
         assertNull(Jar.findJarName("foo", new String[] {"bar"}));
     }
 
+    @Test
     public void testFindJarNameSimpleMatches() {
         assertEquals("foo", Jar.findJarName("foo", new String[] {"foo"}));
         assertEquals("lib/foo", Jar.findJarName("foo",
@@ -84,6 +96,7 @@ public class ProtectedJarMethodsTest ext
                                      new String[] {"lib/foo"}));
     }
 
+    @Test
     public void testFindJarNameLongestMatchWins() {
         assertEquals("lib/foo",
                      Jar.findJarName("lib/foo", 

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java Fri Apr 18 21:00:38 2014
@@ -18,77 +18,86 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.util.FileUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
 
+import static org.junit.Assert.assertTrue;
+
 /**
  */
-public class RecorderTest extends BuildFileTest {
+public class RecorderTest {
+    
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
     private static final String REC_IN = "recorder/";
-    private static final String REC_DIR = "recorder-out/";
 
     /** Utilities used for file operations */
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
 
-    public RecorderTest(String name) {
-        super(name);
-    }
-
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/recorder.xml");
-        executeTarget("setUp");
+        buildRule.configureProject("src/etc/testcases/taskdefs/recorder.xml");
+        buildRule.executeTarget("setUp");
     }
 
+    @Test
     public void testNoAppend() throws IOException {
-        executeTarget("noappend");
+        buildRule.executeTarget("noappend");
         assertTrue(FILE_UTILS
-                   .contentEquals(project.resolveFile(REC_IN
+                   .contentEquals(buildRule.getProject().resolveFile(REC_IN
                                                       + "rectest1.result"),
-                                  new File(getOutputDir(),
+                                  new File(buildRule.getOutputDir(),
                                                       "rectest1.log"), true));
     }
 
+    @Test
     public void testAppend() throws IOException {
-        executeTarget("append");
+        buildRule.executeTarget("append");
         assertTrue(FILE_UTILS
-                   .contentEquals(project.resolveFile(REC_IN
+                   .contentEquals(buildRule.getProject().resolveFile(REC_IN
                                                       + "rectest2.result"),
-                           new File(getOutputDir(),
+                           new File(buildRule.getOutputDir(),
                                                       "rectest2.log"), true));
     }
 
+    @Test
     public void testRestart() throws IOException {
-        executeTarget("restart");
+        buildRule.executeTarget("restart");
         assertTrue(FILE_UTILS
-                   .contentEquals(project.resolveFile(REC_IN
+                   .contentEquals(buildRule.getProject().resolveFile(REC_IN
                                                       + "rectest3.result"),
-                           new File(getOutputDir(), "rectest3.log"), true));
+                           new File(buildRule.getOutputDir(), "rectest3.log"), true));
     }
 
+    @Test
     public void testDeleteRestart() throws IOException {
-        executeTarget("deleterestart");
+        buildRule.executeTarget("deleterestart");
         assertTrue(FILE_UTILS
-                   .contentEquals(project.resolveFile(REC_IN
+                   .contentEquals(buildRule.getProject().resolveFile(REC_IN
                                                       + "rectest4.result"),
-                           new File(getOutputDir(),
+                           new File(buildRule.getOutputDir(),
                                                       "rectest4.log"), true));
     }
 
+    @Test
     public void testSubBuild() throws IOException {
-        executeTarget("subbuild");
+        buildRule.executeTarget("subbuild");
         assertTrue(FILE_UTILS
-                   .contentEquals(project.resolveFile(REC_IN
+                   .contentEquals(buildRule.getProject().resolveFile(REC_IN
                                                       + "rectest5.result"),
-                           new File(getOutputDir(), "rectest5.log"), true));
+                           new File(buildRule.getOutputDir(), "rectest5.log"), true));
         assertTrue(FILE_UTILS
-                   .contentEquals(project.resolveFile(REC_IN
+                   .contentEquals(buildRule.getProject().resolveFile(REC_IN
                                                       + "rectest6.result"),
-                           new File(getOutputDir(), "rectest6.log"), true));
-                                                      
+                           new File(buildRule.getOutputDir(), "rectest6.log"), true));
+
     }
 
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RenameTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RenameTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RenameTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RenameTest.java Fri Apr 18 21:00:38 2014
@@ -17,39 +17,72 @@
  */
 
 package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
 
-/**
- */
-public class RenameTest extends BuildFileTest {
+import static org.junit.Assert.fail;
 
-    public RenameTest(String name) {
-        super(name);
-    }
+public class RenameTest {
+
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/rename.xml");
+        buildRule.configureProject("src/etc/testcases/taskdefs/rename.xml");
     }
 
+    @Test
     public void test1() {
-        expectBuildException("test1", "required argument missing");
+        try {
+            buildRule.executeTarget("test1");
+            fail("BuildException should have been thrown:  required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
+    @Test
     public void test2() {
-        expectBuildException("test2", "required argument missing");
+        try {
+            buildRule.executeTarget("test2");
+            fail("BuildException should have been thrown: required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
+    @Test
     public void test3() {
-        expectBuildException("test3", "required argument missing");
+        try {
+            buildRule.executeTarget("test3");
+            fail("BuildException should have been thrown: required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
-/*
+
+    @Test
+    @Ignore("Previously commented out")
     public void test4() {
-        expectBuildException("test4", "source and destination the same");
+        try {
+            buildRule.executeTarget("test4");
+            fail("BuildException should have been thrown: source and destination the same");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
+
+    @Test
+    @Ignore("Previously commented out")
     public void test5() {
-        executeTarget("test5");
+        buildRule.executeTarget("test5");
     }
-    */
+    @Test
     public void test6() {
-        executeTarget("test6");
+        buildRule.executeTarget("test6");
     }
 
 }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java Fri Apr 18 21:00:38 2014
@@ -18,77 +18,136 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
-
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 
 import junit.framework.AssertionFailedError;
 
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
 /**
  */
-public class ReplaceTest extends BuildFileTest {
-
-    public ReplaceTest(String name) {
-        super(name);
-    }
+public class ReplaceTest {
+    
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Before
     public void setUp() {
-        configureProject("src/etc/testcases/taskdefs/replace.xml");
-        project.executeTarget("setUp");
+        buildRule.configureProject("src/etc/testcases/taskdefs/replace.xml");
+        buildRule.executeTarget("setUp");
     }
 
+    @Test
     public void test1() {
-        expectBuildException("test1", "required argument not specified");
+        try {
+			buildRule.executeTarget("test1");
+			fail("BuildException expected: required argument not specified");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test2() {
-        expectBuildException("test2", "required argument not specified");
+        try {
+			buildRule.executeTarget("test2");
+			fail("BuildException expected: required argument not specified");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test3() {
-        expectBuildException("test3", "required argument not specified");
+        try {
+			buildRule.executeTarget("test3");
+			fail("BuildException expected: required argument not specified");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test4() {
-        expectBuildException("test4", "empty token not allowed");
+        try {
+			buildRule.executeTarget("test4");
+			fail("BuildException expected: empty token not allowed");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test5() {
-        executeTarget("test5");
+        buildRule.executeTarget("test5");
     }
 
+    @Test
     public void test6() {
-        expectBuildException("test6", "required argument not specified");
+        try {
+			buildRule.executeTarget("test6");
+			fail("BuildException expected: required argument not specified");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test7() {
-        expectBuildException("test7", "empty token not allowed");
+        try {
+			buildRule.executeTarget("test7");
+			fail("BuildException expected: empty token not allowed");
+		} catch (BuildException ex) {
+			//TODO assert value
+		}
     }
 
+    @Test
     public void test8() {
-        executeTarget("test8");
+        buildRule.executeTarget("test8");
     }
 
+    @Test
     public void test9() throws IOException {
-        executeTarget("test9");
-        assertEqualContent(new File(getOutputDir(), "result.txt"),
-                    new File(getOutputDir(), "output.txt"));
+
+        buildRule.executeTarget("test9");
+        assertEqualContent(new File(buildRule.getOutputDir(), "result.txt"),
+                    new File(buildRule.getOutputDir(), "output.txt"));
     }
 
+    @Test
     public void testNoPreserveLastModified() throws Exception {
-        executeTarget("lastModifiedSetup");
-        long ts1 = new File(getOutputDir(), "test.txt").lastModified();
-        Thread.sleep(3000);
-        executeTarget("testNoPreserve");
-        assertTrue(ts1 < new File(getOutputDir(), "test.txt").lastModified());
+        buildRule.executeTarget("lastModifiedSetup");
+        File testFile = new File(buildRule.getOutputDir(), "test.txt");
+        assumeTrue("Could not change file modification time",
+                testFile.setLastModified(testFile.lastModified() - (FileUtils.getFileUtils().getFileTimestampGranularity() * 5)));
+        long ts1 = testFile.lastModified();
+        buildRule.executeTarget("testNoPreserve");
+        assertTrue(ts1 < new File(buildRule.getOutputDir(), "test.txt").lastModified());
     }
 
+    @Test
     public void testPreserveLastModified() throws Exception {
-        executeTarget("lastModifiedSetup");
-        long ts1 = new File(getOutputDir(), "test.txt").lastModified();
-        Thread.sleep(3000);
-        executeTarget("testPreserve");
-        assertTrue(ts1 == new File(getOutputDir(), "test.txt").lastModified());
+        buildRule.executeTarget("lastModifiedSetup");
+        File testFile = new File(buildRule.getOutputDir(), "test.txt");
+        assumeTrue("Could not change file modification time",
+                testFile.setLastModified(testFile.lastModified() - (FileUtils.getFileUtils().getFileTimestampGranularity() * 5)));
+        long ts1 = testFile.lastModified();buildRule.executeTarget("testPreserve");
+        assertTrue(ts1 == new File(buildRule.getOutputDir(), "test.txt").lastModified());
     }
 
     public void assertEqualContent(File expect, File result)

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java Fri Apr 18 21:00:38 2014
@@ -19,222 +19,272 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory;
 import org.apache.tools.ant.taskdefs.rmic.DefaultRmicAdapter;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
 
 /**
  * Date: 04-Aug-2004
  * Time: 22:15:46
  */
-public class RmicAdvancedTest extends BuildFileTest {
-
-    public RmicAdvancedTest(String name) {
-        super(name);
-    }
+public class RmicAdvancedTest {
 
     private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/rmic/";
 
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
     /**
      * The JUnit setup method
      */
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
-        configureProject(TASKDEFS_DIR + "rmic.xml");
+        buildRule.configureProject(TASKDEFS_DIR + "rmic.xml");
     }
 
     /**
      * verify that "default" binds us to the default compiler
      */
+    @Test
     public void testDefault() throws Exception {
-        executeTarget("testDefault");
+        buildRule.executeTarget("testDefault");
     }
 
     /**
      * verify that "default" binds us to the default compiler
      */
+    @Test
     public void testDefaultDest() throws Exception {
-        executeTarget("testDefaultDest");
+        buildRule.executeTarget("testDefaultDest");
     }
 
     /**
      * verify that "" binds us to the default compiler
      */
+    @Test
     public void testEmpty() throws Exception {
-        executeTarget("testEmpty");
+        buildRule.executeTarget("testEmpty");
     }
 
     /**
      * verify that "" binds us to the default compiler
      */
+    @Test
     public void testEmptyDest() throws Exception {
-        executeTarget("testEmptyDest");
+        buildRule.executeTarget("testEmptyDest");
     }
 
     /**
      * test sun's rmic compiler
      */
+    @Test
     public void testRmic() throws Exception {
-        executeTarget("testRmic");
+        buildRule.executeTarget("testRmic");
     }
 
     /**
      * test sun's rmic compiler
      */
+    @Test
     public void testRmicDest() throws Exception {
-        executeTarget("testRmicDest");
+        buildRule.executeTarget("testRmicDest");
     }
 
     /**
      * test sun's rmic compiler strips
      * out -J arguments when not forking
      */
+    @Test
     public void testRmicJArg() throws Exception {
-        executeTarget("testRmicJArg");
+        buildRule.executeTarget("testRmicJArg");
     }
 
     /**
      * test sun's rmic compiler strips
      * out -J arguments when not forking
      */
+    @Test
     public void testRmicJArgDest() throws Exception {
-        executeTarget("testRmicJArgDest");
+        buildRule.executeTarget("testRmicJArgDest");
     }
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testKaffe() throws Exception {
-        executeTarget("testKaffe");
+        buildRule.executeTarget("testKaffe");
     }
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testKaffeDest() throws Exception {
-        executeTarget("testKaffeDest");
+        buildRule.executeTarget("testKaffeDest");
     }
 
     // WLrmic tests don't work
     /**
      * test weblogic
      */
+    @Test
+    @Ignore("WLRmin tests don't work")
     public void XtestWlrmic() throws Exception {
-        executeTarget("testWlrmic");
+        buildRule.executeTarget("testWlrmic");
     }
 
     /**
      *  test weblogic's stripping of -J args
      */
+    @Test
+    @Ignore("WLRmin tests don't work")
     public void XtestWlrmicJArg() throws Exception {
-        executeTarget("testWlrmicJArg");
+        buildRule.executeTarget("testWlrmicJArg");
     }
 
     /**
      * test the forking compiler
      */
+    @Test
+    @Ignore("WLRmin tests don't work")
     public void NotestForking() throws Exception {
-        executeTarget("testForking");
+        buildRule.executeTarget("testForking");
     }
 
     /**
      * test the forking compiler
      */
+    @Test
     public void testForkingAntClasspath() throws Exception {
-        executeTarget("testForkingAntClasspath");
+        buildRule.executeTarget("testForkingAntClasspath");
     }
 
     /**
      * test the forking compiler
      */
+    @Test
     public void testForkingAntClasspathDest() throws Exception {
-        executeTarget("testForkingAntClasspathDest");
+        buildRule.executeTarget("testForkingAntClasspathDest");
     }
 
     /**
      * test the forking compiler
      */
+    @Test
     public void testAntClasspath() throws Exception {
-        executeTarget("testAntClasspath");
+        buildRule.executeTarget("testAntClasspath");
     }
 
     /**
      * test the forking compiler
      */
+    @Test
     public void testAntClasspathDest() throws Exception {
-        executeTarget("testAntClasspathDest");
+        buildRule.executeTarget("testAntClasspathDest");
     }
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testBadName() throws Exception {
-        expectBuildExceptionContaining("testBadName",
-                "compiler not known",
-                RmicAdapterFactory.ERROR_UNKNOWN_COMPILER);
+        try {
+            buildRule.executeTarget("testBadName");
+            fail("Compile not known");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(RmicAdapterFactory.ERROR_UNKNOWN_COMPILER, ex.getMessage());
+        }
     }
 
     /**
      * load an adapter by name
      */
+    @Test
     public void testExplicitClass() throws Exception {
-        executeTarget("testExplicitClass");
+        buildRule.executeTarget("testExplicitClass");
     }
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testWrongClass() throws Exception {
-        expectBuildExceptionContaining("testWrongClass",
-                "class not an RMIC adapter",
-                RmicAdapterFactory.ERROR_NOT_RMIC_ADAPTER);
+        try {
+            buildRule.executeTarget("testWrongClass");
+            fail("Class not an RMIC adapter");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(RmicAdapterFactory.ERROR_NOT_RMIC_ADAPTER, ex.getMessage());
+        }
     }
 
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testDefaultBadClass() throws Exception {
-        expectBuildExceptionContaining("testDefaultBadClass",
-                "expected the class to fail",
-                Rmic.ERROR_RMIC_FAILED);
+        try {
+            buildRule.executeTarget("testDefaultBadClass");
+            fail("expected the class to fail");
+        } catch(BuildException ex) {
+            AntAssert.assertContains(Rmic.ERROR_RMIC_FAILED, ex.getMessage());
+        }
         //dont look for much text here as it is vendor and version dependent
-        assertLogContaining("unimplemented.class");
+        AntAssert.assertContains("unimplemented.class", buildRule.getLog());
     }
 
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testMagicProperty() throws Exception {
-        expectBuildExceptionContaining("testMagicProperty",
-                "magic property not working",
-                RmicAdapterFactory.ERROR_UNKNOWN_COMPILER);
+        try {
+            buildRule.executeTarget("testMagicProperty");
+            fail("Magic property not working");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(RmicAdapterFactory.ERROR_UNKNOWN_COMPILER, ex.getMessage());
+        }
     }
 
     /**
      * A unit test for JUnit
      */
+    @Test
     public void testMagicPropertyOverridesEmptyString() throws Exception {
-        expectBuildExceptionContaining("testMagicPropertyOverridesEmptyString",
-                "magic property not working",
-                RmicAdapterFactory.ERROR_UNKNOWN_COMPILER);
+        try {
+            buildRule.executeTarget("testMagicPropertyOverridesEmptyString");
+            fail("Magic property not working");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(RmicAdapterFactory.ERROR_UNKNOWN_COMPILER, ex.getMessage());
+        }
     }
 
 
-    /**
-     *
-     */
+    @Test
     public void testMagicPropertyIsEmptyString() throws Exception {
-        executeTarget("testMagicPropertyIsEmptyString");
+        buildRule.executeTarget("testMagicPropertyIsEmptyString");
     }
 
 
+    @Test
+    @Ignore("Previously named to prevent execution")
     public void NotestFailingAdapter() throws Exception {
-        expectBuildExceptionContaining("testFailingAdapter",
-                "expected failures to propagate",
-                Rmic.ERROR_RMIC_FAILED);
+        try {
+            buildRule.executeTarget("testFailingAdapter");
+            fail("Expected failures to propogate");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(Rmic.ERROR_RMIC_FAILED, ex.getMessage());
+        }
     }
 
 
@@ -242,16 +292,18 @@ public class RmicAdvancedTest extends Bu
      * test that version 1.1 stubs are good
      * @throws Exception
      */
+    @Test
     public void testVersion11() throws Exception {
-        executeTarget("testVersion11");
+        buildRule.executeTarget("testVersion11");
     }
 
     /**
      * test that version 1.1 stubs are good
      * @throws Exception
      */
+    @Test
     public void testVersion11Dest() throws Exception {
-        executeTarget("testVersion11Dest");
+        buildRule.executeTarget("testVersion11Dest");
     }
 
     /**
@@ -259,8 +311,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testVersion12() throws Exception {
-        executeTarget("testVersion12");
+        buildRule.executeTarget("testVersion12");
     }
 
     /**
@@ -268,8 +321,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testVersion12Dest() throws Exception {
-        executeTarget("testVersion12Dest");
+        buildRule.executeTarget("testVersion12Dest");
     }
 
     /**
@@ -277,8 +331,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testVersionCompat() throws Exception {
-        executeTarget("testVersionCompat");
+        buildRule.executeTarget("testVersionCompat");
     }
 
     /**
@@ -286,8 +341,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testVersionCompatDest() throws Exception {
-        executeTarget("testVersionCompatDest");
+        buildRule.executeTarget("testVersionCompatDest");
     }
 
     /**
@@ -295,8 +351,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testXnew() throws Exception {
-        executeTarget("testXnew");
+        buildRule.executeTarget("testXnew");
     }
 
     /**
@@ -304,8 +361,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testXnewDest() throws Exception {
-        executeTarget("testXnewDest");
+        buildRule.executeTarget("testXnewDest");
     }
 
     /**
@@ -313,8 +371,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testXnewForked() throws Exception {
-        executeTarget("testXnewForked");
+        buildRule.executeTarget("testXnewForked");
     }
 
     /**
@@ -322,8 +381,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testXnewForkedDest() throws Exception {
-        executeTarget("testXnewForkedDest");
+        buildRule.executeTarget("testXnewForkedDest");
     }
 
     /**
@@ -331,8 +391,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testXnewCompiler() throws Exception {
-        executeTarget("testXnewCompiler");
+        buildRule.executeTarget("testXnewCompiler");
     }
 
     /**
@@ -340,8 +401,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testXnewCompilerDest() throws Exception {
-        executeTarget("testXnewCompilerDest");
+        buildRule.executeTarget("testXnewCompilerDest");
     }
 
     /**
@@ -349,8 +411,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testIDL() throws Exception {
-        executeTarget("testIDL");
+        buildRule.executeTarget("testIDL");
     }
 
     /**
@@ -358,8 +421,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testIDLDest() throws Exception {
-        executeTarget("testIDLDest");
+        buildRule.executeTarget("testIDLDest");
     }
 
     /**
@@ -367,8 +431,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testIIOP() throws Exception {
-        executeTarget("testIIOP");
+        buildRule.executeTarget("testIIOP");
     }
 
     /**
@@ -376,8 +441,9 @@ public class RmicAdvancedTest extends Bu
      *
      * @throws Exception
      */
+    @Test
     public void testIIOPDest() throws Exception {
-        executeTarget("testIIOPDest");
+        buildRule.executeTarget("testIIOPDest");
     }
 
     /**

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java?rev=1588563&r1=1588562&r2=1588563&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java Fri Apr 18 21:00:38 2014
@@ -19,7 +19,11 @@
 package org.apache.tools.ant.taskdefs;
 
 import org.apache.tools.ant.Project;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 
 /**
@@ -27,15 +31,12 @@ import junit.framework.TestCase;
  *
  * @since Ant 1.5
  */
-public class RmicTest extends TestCase {
+public class RmicTest {
 
     private Project project;
     private Rmic rmic;
 
-    public RmicTest(String name) {
-        super(name);
-    }
-
+    @Before
     public void setUp() {
         project = new Project();
         project.init();
@@ -46,6 +47,7 @@ public class RmicTest extends TestCase {
     /**
      * Test nested compiler args.
      */
+    @Test
     public void testCompilerArg() {
         String[] args = rmic.getCurrentCompilerArgs();
         assertNotNull(args);
@@ -81,6 +83,7 @@ public class RmicTest extends TestCase {
     /**
      * Test compiler attribute.
      */
+    @Test
     public void testCompilerAttribute() {
         // check defaults
         String compiler = rmic.getCompiler();