http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
index 2751ea5..94b163e 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
@@ -28,11 +28,11 @@ import org.apache.tools.ant.TypeAdapter;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
+import static org.junit.Assert.assertThat;
 
 /**
  */
@@ -41,6 +41,8 @@ public class TypeAdapterTest {
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
 
     @Before
     public void setUp() {
@@ -50,35 +52,32 @@ public class TypeAdapterTest {
     @Test
     public void testTaskAdapter() {
         buildRule.executeTarget("taskadapter");
-        assertContains("MyExec called", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("MyExec called"));
     }
 
     @Test
     public void testRunAdapter() {
         buildRule.executeTarget("runadapter");
-        assertContains("MyRunnable called", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("MyRunnable called"));
     }
 
     @Test
     public void testRunAdapterError() {
-        try {
-            buildRule.executeTarget("runadaptererror");
-            fail("BuildException expected: no public run method");
-        } catch (BuildException ex) {
-            assertContains("No public run() method in", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("No public run() method in");
+        buildRule.executeTarget("runadaptererror");
     }
 
     @Test
     public void testDelay() {
         buildRule.executeTarget("delay");
-        assertContains("MyTask called", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("MyTask called"));
     }
 
     @Test
     public void testOnErrorReport() {
         buildRule.executeTarget("onerror.report");
-        assertContains("MyTaskNotPresent cannot be found", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("MyTaskNotPresent cannot 
be found"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
index 0b93826..d8e5821 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
@@ -23,11 +23,12 @@ import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThat;
 
 /**
  */
@@ -36,50 +37,36 @@ public class TypedefTest {
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
 
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/typedef.xml");
     }
 
-    @Test
+    @Test(expected = BuildException.class)
     public void testEmpty() {
-        try {
-            buildRule.executeTarget("empty");
-            fail("BuildException expected: required argument not specified");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("empty");
+        // TODO assert value
     }
 
-    @Test
+    @Test(expected = BuildException.class)
     public void testNoName() {
-        try {
-            buildRule.executeTarget("noName");
-            fail("BuildException expected: required argument not specified");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("noName");
+        // TODO assert value
     }
 
-    @Test
+    @Test(expected = BuildException.class)
     public void testNoClassname() {
-        try {
-            buildRule.executeTarget("noClassname");
-            fail("BuildException expected: required argument not specified");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("noClassname");
+        // TODO assert value
     }
 
-    @Test
+    @Test(expected = BuildException.class)
     public void testClassNotFound() {
-        try {
-            buildRule.executeTarget("classNotFound");
-            fail("BuildException expected: classname specified doesn't exist");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("classNotFound");
+        // TODO assert value
     }
 
     @Test
@@ -88,8 +75,7 @@ public class TypedefTest {
         assertEquals("", buildRule.getLog());
         Object ref = buildRule.getProject().getReferences().get("global");
         assertNotNull("ref is not null", ref);
-        assertEquals("org.example.types.TypedefTestType",
-                     ref.getClass().getName());
+        assertEquals("org.example.types.TypedefTestType", 
ref.getClass().getName());
     }
 
     @Test
@@ -98,8 +84,7 @@ public class TypedefTest {
         assertEquals("", buildRule.getLog());
         Object ref = buildRule.getProject().getReferences().get("local");
         assertNotNull("ref is not null", ref);
-        assertEquals("org.example.types.TypedefTestType",
-                     ref.getClass().getName());
+        assertEquals("org.example.types.TypedefTestType", 
ref.getClass().getName());
     }
 
     /**
@@ -109,28 +94,25 @@ public class TypedefTest {
     @Test
     public void testDoubleNotPresent() {
         buildRule.executeTarget("double-notpresent");
-        assertContains("hi", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("hi"));
     }
 
     @Test
     public void testNoResourceOnErrorFailAll() {
-            try {
-            buildRule.executeTarget("noresourcefailall");
-            fail("BuildException expected: the requested resource does not 
exist");
-        } catch (BuildException ex) {
-            assertContains("Could not load definitions from resource ", 
ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("Could not load definitions from resource ");
+        buildRule.executeTarget("noresourcefailall");
     }
 
     @Test
     public void testNoResourceOnErrorFail() {
         buildRule.executeTarget("noresourcefail");
-        assertContains("Could not load definitions from resource ", 
buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Could not load 
definitions from resource "));
     }
 
     @Test
     public void testNoResourceOnErrorNotFail() {
-            buildRule.executeTarget("noresourcenotfail");
-        assertContains("Could not load definitions from resource ", 
buildRule.getLog());
+        buildRule.executeTarget("noresourcenotfail");
+        assertThat(buildRule.getLog(), containsString("Could not load 
definitions from resource "));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
index 60f2977..b15ef27 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
@@ -33,12 +33,12 @@ import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assume.assumeTrue;
 
 public class ZipTest {
@@ -49,52 +49,47 @@ public class ZipTest {
     //instance variable to allow cleanup
     ZipFile zfPrefixAddsDir = null;
 
-
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/zip.xml");
         buildRule.executeTarget("setUp");
     }
 
-    @Test
+    /**
+     * Fail due to required argument not specified
+     */
+    @Test(expected = BuildException.class)
     public void test1() {
-        try {
-            buildRule.executeTarget("test1");
-            fail("BuildException expected: required argument not specified");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("test1");
+        //TODO assert value
     }
 
-    @Test
+    /**
+     * Fail due to required argument not specified
+     */
+    @Test(expected = BuildException.class)
     public void test2() {
-        try {
-            buildRule.executeTarget("test2");
-            fail("BuildException expected: required argument not specified");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("test2");
+        //TODO assert value
     }
 
-    @Test
+    /**
+     * Fail because zip cannot include itself
+     */
+    @Test(expected = BuildException.class)
     public void test3() {
-        try {
-            buildRule.executeTarget("test3");
-            fail("BuildException expected: zip cannot include itself");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("test3");
+        //TODO assert value
     }
 
-    @Test
+    /**
+     * Fail because zip cannot include itself
+     */
+    @Test(expected = BuildException.class)
     @Ignore("Previously commented out")
     public void test4() {
-        try {
-            buildRule.executeTarget("test4");
-            fail("BuildException expected: zip cannot include itself");
-        } catch (BuildException ex) {
-            //TODO assert value
-        }
+        buildRule.executeTarget("test4");
+        //TODO assert value
     }
 
     @After
@@ -150,13 +145,13 @@ public class ZipTest {
     @Test
     public void testUpdateNotNecessary() {
        buildRule.executeTarget("testUpdateNotNecessary");
-       assertFalse(buildRule.getLog().contains("Updating"));
+       assertThat(buildRule.getLog(), not(containsString("Updating")));
     }
 
     @Test
     public void testUpdateIsNecessary() {
         buildRule.executeTarget("testUpdateIsNecessary");
-        assertContains("Updating", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Updating"));
     }
 
     // Bugzilla Report 18403
@@ -204,7 +199,7 @@ public class ZipTest {
     @Test
     public void testZipEmptyCreate() {
         buildRule.executeTarget("zipEmptyCreate");
-        assertContains("Note: creating empty", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Note: creating empty"));
     }
 
     // Bugzilla Report 25513

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
index 7409b79..9c33cdf 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
@@ -34,10 +34,11 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.util.FileUtils;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 public class DefaultCompilerAdapterTest {
@@ -419,8 +420,8 @@ public class DefaultCompilerAdapterTest {
         sth.setJavac(javac);
         Commandline cmd = new Commandline();
         sth.setupModernJavacCommandlineSwitches(cmd);
-        assertContains("Support for javac --release has been added in "
-                       + "Java9 ignoring it", javac.getLog());
+        assertThat(javac.getLog(),
+                containsString("Support for javac --release has been added in 
Java9 ignoring it"));
         String[] args = cmd.getCommandline();
         assertEquals(7, args.length);
         assertEquals("-classpath", args[0]);
@@ -445,8 +446,8 @@ public class DefaultCompilerAdapterTest {
         sth.setJavac(javac);
         Commandline cmd = new Commandline();
         sth.setupModernJavacCommandlineSwitches(cmd);
-        assertContains("Ignoring source, target and bootclasspath as "
-                       + "release has been set", javac.getLog());
+        assertThat(javac.getLog(),
+                containsString("Ignoring source, target and bootclasspath as 
release has been set"));
         String[] args = cmd.getCommandline();
         assertEquals(5, args.length);
         assertEquals("-classpath", args[0]);
@@ -491,8 +492,7 @@ public class DefaultCompilerAdapterTest {
         if (expectedLog.isEmpty()) {
             assertEquals("", javac.getLog());
         } else {
-            String l = javac.getLog();
-            assertContains(expectedLog, l);
+            assertThat(javac.getLog(), containsString(expectedLog));
         }
         String[] args = cmd.getCommandline();
         assertEquals(expectedSource == null ? 0 : 2, args.length);

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
index 10049fc..eaab2ce 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
@@ -23,9 +23,7 @@ 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;
+import org.junit.rules.ExpectedException;
 
 /**
  * Testcase for the <isfileselected> condition.
@@ -36,6 +34,9 @@ public class IsFileSelectedTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         
buildRule.configureProject("src/etc/testcases/taskdefs/conditions/isfileselected.xml");
@@ -63,12 +64,8 @@ public class IsFileSelectedTest {
 
     @Test
     public void testNotSelector() {
-        try {
-            buildRule.executeTarget("not.selector");
-            fail("Exception should have been thrown: checking for use as a 
selector (not allowed)");
-        } catch (BuildException ex) {
-            assertContains("fileset doesn't support the nested \"isfile",
-                    ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("fileset doesn't support the nested 
\"isfileselected\"");
+        buildRule.executeTarget("not.selector");
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
index 87e3712..a884746 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
@@ -23,10 +23,7 @@ import org.junit.Before;
 import org.junit.Ignore;
 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;
+import org.junit.rules.ExpectedException;
 
 /**
  * test for reachable things
@@ -36,10 +33,12 @@ public class IsReachableTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
-        buildRule.configureProject(
-                "src/etc/testcases/taskdefs/conditions/isreachable.xml");
+        
buildRule.configureProject("src/etc/testcases/taskdefs/conditions/isreachable.xml");
     }
 
     @Test
@@ -64,52 +63,37 @@ public class IsReachableTest {
 
     @Test
     public void testBoth() {
-        try {
-           buildRule.executeTarget("testBoth");
-           fail("Build exception expected: error on two targets");
-        } catch (BuildException ex) {
-            assertEquals(IsReachable.ERROR_BOTH_TARGETS, ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(IsReachable.ERROR_BOTH_TARGETS);
+        buildRule.executeTarget("testBoth");
     }
 
     @Test
     public void testNoTargets() {
-        try {
-            buildRule.executeTarget("testNoTargets");
-            fail("Build exception expected: no params");
-        } catch (BuildException ex) {
-            assertEquals(IsReachable.ERROR_NO_HOSTNAME, ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(IsReachable.ERROR_NO_HOSTNAME);
+        buildRule.executeTarget("testNoTargets");
     }
 
     @Test
     public void testBadTimeout() {
-        try {
-            buildRule.executeTarget("testBadTimeout");
-            fail("Build exception expected: error on -ve timeout");
-        } catch (BuildException ex) {
-            assertEquals(IsReachable.ERROR_BAD_TIMEOUT, ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(IsReachable.ERROR_BAD_TIMEOUT);
+        buildRule.executeTarget("testBadTimeout");
     }
 
     @Test
     @Ignore("Previously named in a way to prevent execution")
     public void NotestFile() {
-        try {
-            buildRule.executeTarget("testFile");
-            fail("Build exception expected: error on file URL");
-        } catch (BuildException ex) {
-            assertEquals(IsReachable.ERROR_NO_HOST_IN_URL, ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(IsReachable.ERROR_NO_HOST_IN_URL);
+        buildRule.executeTarget("testFile");
     }
 
     @Test
     public void testBadURL() {
-        try {
-            buildRule.executeTarget("testBadURL");
-            fail("Build exception expected: error in URL");
-        } catch (BuildException ex) {
-            assertContains(IsReachable.ERROR_BAD_URL, ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(IsReachable.ERROR_BAD_URL);
+        buildRule.executeTarget("testBadURL");
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
index 45df9a8..fabb589 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
@@ -22,10 +22,9 @@ import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
 import static org.junit.Assert.assertNull;
 
 /**
@@ -36,6 +35,9 @@ public class TypeFoundTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         
buildRule.configureProject("src/etc/testcases/taskdefs/conditions/typefound.xml");
@@ -49,12 +51,9 @@ public class TypeFoundTest {
 
     @Test
     public void testUndefined() {
-        try {
-            buildRule.executeTarget("testUndefined");
-            fail("Build exception expected: left out the name attribute");
-        } catch (BuildException ex) {
-            assertContains("No type specified", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("No type specified");
+        buildRule.executeTarget("testUndefined");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
index f57e418..ba0b292 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
@@ -28,8 +28,9 @@ import org.junit.Test;
 import java.io.File;
 import java.io.FilenameFilter;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -178,32 +179,32 @@ public class ANTLRTest {
     @Test
     public void testNoRecompile() {
         buildRule.executeTarget("test9");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), not(containsString("Skipped grammar 
file.")));
         buildRule.executeTarget("noRecompile");
-        assertContains("Skipped grammar file.", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), containsString("Skipped grammar 
file."));
     }
 
     @Test
     public void testNormalRecompile() {
         buildRule.executeTarget("test9");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), not(containsString("Skipped grammar 
file.")));
 
         FileUtilities.rollbackTimestamps(buildRule.getOutputDir(), 5);
 
         buildRule.executeTarget("normalRecompile");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), not(containsString("Skipped grammar 
file.")));
     }
 
     @Test
     // Bugzilla Report 12961
     public void testSupergrammarChangeRecompile() {
         buildRule.executeTarget("test9");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), not(containsString("Skipped grammar 
file.")));
 
         FileUtilities.rollbackTimestamps(buildRule.getOutputDir(), 5);
 
         buildRule.executeTarget("supergrammarChangeRecompile");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), not(containsString("Skipped grammar 
file.")));
 
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
index 68275f2..bc298f8 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
@@ -18,11 +18,11 @@
 
 package org.apache.tools.ant.taskdefs.optional;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
 import java.io.BufferedInputStream;
@@ -41,6 +41,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 /**
  * Tests the EchoProperties task.
@@ -59,6 +60,9 @@ public class EchoPropertiesTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         buildRule.configureProject(TASKDEFS_DIR + "echoproperties.xml");
@@ -73,45 +77,39 @@ public class EchoPropertiesTest {
     @Test
     public void testEchoToLog() {
         buildRule.executeTarget("testEchoToLog");
-        assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("test.property=" + 
TEST_VALUE));
     }
 
     @Test
     public void testEchoWithEmptyPrefixToLog() {
         buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
-        assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("test.property=" + 
TEST_VALUE));
     }
 
     @Test
     public void testReadBadFile() {
-        try {
-            buildRule.executeTarget("testReadBadFile");
-            fail("BuildException should have been thrown on bad file");
-        } catch (BuildException ex) {
-            assertContains("srcfile is a directory", "srcfile is a 
directory!", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("srcfile is a directory!");
+        buildRule.executeTarget("testReadBadFile");
     }
 
     @Test
     public void testReadBadFileNoFail() {
         buildRule.executeTarget("testReadBadFileNoFail");
-        assertContains("srcfile is a directory!", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("srcfile is a 
directory!"));
     }
 
     @Test
     public void testEchoToBadFile() {
-        try {
-            buildRule.executeTarget("testEchoToBadFile");
-            fail("BuildException should have been thrown on destination file 
being a directory");
-        } catch (BuildException ex) {
-            assertContains("destfile is a directory", "destfile is a 
directory!", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("destfile is a directory!");
+        buildRule.executeTarget("testEchoToBadFile");
     }
 
     @Test
     public void testEchoToBadFileNoFail() {
         buildRule.executeTarget("testEchoToBadFileNoFail");
-        assertContains("destfile is a directory!", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("destfile is a 
directory!"));
     }
 
     @Test
@@ -127,14 +125,8 @@ public class EchoPropertiesTest {
         // read in the file
         File f = createRelativeFile(GOOD_OUTFILE_XML);
         try (BufferedReader br = new BufferedReader(new FileReader(f))) {
-            String read = null;
-            while ((read = br.readLine()) != null) {
-                if (read.contains("<property name=\"test.property\" value=\"" 
+ TEST_VALUE + "\" />")) {
-                    // found the property we set - it's good.
-                    return;
-                }
-            }
-            fail("did not encounter set property in generated file.");
+            assertTrue("did not encounter set property in generated file.", 
br.lines().anyMatch(line
+                    -> line.contains("<property name=\"test.property\" 
value=\"" + TEST_VALUE + "\" />")));
         }
     }
 
@@ -172,19 +164,15 @@ public class EchoPropertiesTest {
 
     @Test
     public void testWithPrefixAndRegex() {
-        try {
-            buildRule.executeTarget("testWithPrefixAndRegex");
-            fail("BuildException should have been thrown on Prefix and RegEx 
being set");
-        } catch (BuildException ex) {
-            assertEquals("The target must fail with prefix and regex 
attributes set",
-                    "Please specify either prefix or regex, but not both", 
ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("Please specify either prefix or regex, but not 
both");
+        buildRule.executeTarget("testWithPrefixAndRegex");
     }
 
     @Test
     public void testWithEmptyPrefixAndRegex() {
         buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
-        assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("test.property=" + 
TEST_VALUE));
     }
 
     @Test
@@ -194,7 +182,7 @@ public class EchoPropertiesTest {
         buildRule.executeTarget("testWithRegex");
         // the following line has been changed from checking ant.home to 
ant.version
         // so the test will still work when run outside of an Ant script
-        assertContains("ant.version=", buildRule.getFullLog());
+        assertThat(buildRule.getFullLog(), containsString("ant.version="));
     }
 
     private void testEchoPrefixVarious(String target) throws Exception {
@@ -231,10 +219,7 @@ public class EchoPropertiesTest {
     }
 
     protected File createRelativeFile(String filename) {
-        if (filename.equals(".")) {
-            return buildRule.getProject().getBaseDir();
-        }
-        // else
-        return new File(buildRule.getProject().getBaseDir(), filename);
+        return filename.equals(".") ? buildRule.getProject().getBaseDir()
+                : new File(buildRule.getProject().getBaseDir(), filename);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
index 1370038..a18db0e 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
@@ -23,25 +23,23 @@ import org.apache.tools.ant.taskdefs.Execute;
 import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
 import org.apache.tools.ant.types.Commandline;
 
+import org.junit.Rule;
 import org.junit.Test;
-
-import static org.junit.Assert.fail;
-import static org.apache.tools.ant.AntAssert.assertContains;
+import org.junit.rules.ExpectedException;
 
 public class RpmTest {
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Test
     public void testShouldThrowExceptionWhenRpmFails() {
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("' failed with exit code 2");
         Rpm rpm = new MyRpm();
         rpm.setProject(new Project());
         rpm.setFailOnError(true);
-        // execute
-        try {
-            rpm.execute();
-            fail("should have thrown a build exception");
-        } catch (BuildException ex) {
-            assertContains("' failed with exit code 2", ex.getMessage());
-        }
+        rpm.execute();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
index 81215c8..1cb0451 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
@@ -22,9 +22,7 @@ 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;
+import org.junit.rules.ExpectedException;
 
 /**
  * Test schema validation
@@ -40,6 +38,9 @@ public class SchemaValidateTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         buildRule.configureProject(TASKDEFS_DIR + "schemavalidate.xml");
@@ -63,56 +64,37 @@ public class SchemaValidateTest {
 
     @Test
     public void testNoEmptySchemaNamespace() {
-        try {
-            buildRule.executeTarget("testNoEmptySchemaNamespace");
-            fail("Empty namespace URI");
-        } catch (BuildException ex) {
-            assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, 
ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(SchemaValidate.SchemaLocation.ERROR_NO_URI);
+        buildRule.executeTarget("testNoEmptySchemaNamespace");
     }
 
     @Test
     public void testNoEmptySchemaLocation() {
-        try {
-            buildRule.executeTarget("testNoEmptySchemaLocation");
-            fail("Empty schema location");
-        } catch (BuildException ex) {
-            assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
-                    ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION);
+        buildRule.executeTarget("testNoEmptySchemaLocation");
     }
 
     @Test
     public void testNoFile() {
-        try {
-            buildRule.executeTarget("testNoFile");
-            fail("No file at file attribute");
-        } catch (BuildException ex) {
-            assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
-                    ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(SchemaValidate.SchemaLocation.ERROR_NO_FILE);
+        buildRule.executeTarget("testNoFile");
     }
 
     @Test
     public void testNoDoubleSchemaLocation() {
-        try {
-            buildRule.executeTarget("testNoDoubleSchemaLocation");
-            fail("Two locations for schemas");
-        } catch (BuildException ex) {
-            assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
-                    ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        
thrown.expectMessage(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS);
+        buildRule.executeTarget("testNoDoubleSchemaLocation");
     }
 
     @Test
     public void testNoDuplicateSchema() {
-        try {
-            buildRule.executeTarget("testNoDuplicateSchema");
-            fail("duplicate schemas with different values");
-        } catch (BuildException ex) {
-            assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
-                    ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage(SchemaValidate.ERROR_DUPLICATE_SCHEMA);
+        buildRule.executeTarget("testNoDuplicateSchema");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
index 3e9c258..8faaf50 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
@@ -22,10 +22,7 @@ import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.junit.internal.AssumptionViolatedException;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.rules.ExpectedException;
 
 /**
  * Tests the XMLValidate optional task, by running targets in the test script
@@ -45,6 +42,9 @@ public class XmlValidateTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
@@ -104,42 +104,23 @@ public class XmlValidateTest {
     }
 
     /**
-     * Test xml schema validation
+     * Test xml schema validation,
+     * implicitly assume schema-supporting parser (Java 5+)
      */
     @Test
     public void testXmlSchemaGood() throws BuildException {
-        try {
-            buildRule.executeTarget("testSchemaGood");
-        } catch (BuildException e) {
-            if (e.getMessage().endsWith(
-                    " doesn't recognize feature 
http://apache.org/xml/features/validation/schema";)
-                    || e.getMessage().endsWith(
-                            " doesn't support feature 
http://apache.org/xml/features/validation/schema";)) {
-                throw new AssumptionViolatedException("parser doesn't support 
schema");
-            } else {
-                throw e;
-            }
-        }
+        buildRule.executeTarget("testSchemaGood");
     }
+
     /**
-     * Test xml schema validation
+     * Test xml schema validation,
+     * implicitly assume schema-supporting parser (Java 5+)
      */
     @Test
     public void testXmlSchemaBad() {
-        try {
-            buildRule.executeTarget("testSchemaBad");
-            fail("Should throw BuildException because 'Bad Schema 
Validation'");
-        } catch (BuildException e) {
-            if (e.getMessage().endsWith(
-                    " doesn't recognize feature 
http://apache.org/xml/features/validation/schema";)
-                    || e.getMessage().endsWith(
-                            " doesn't support feature 
http://apache.org/xml/features/validation/schema";)) {
-                throw new AssumptionViolatedException("parser doesn't support 
schema");
-            } else {
-                assertTrue(
-                        e.getMessage().contains("not a valid XML document"));
-            }
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("not a valid XML document");
+        buildRule.executeTarget("testSchemaBad");
     }
 
     /**
@@ -160,30 +141,24 @@ public class XmlValidateTest {
      *
      * Bug 11279
      */
-    @Test
+    @Test(expected = BuildException.class)
     public void testUtf8() {
-        try {
-            buildRule.executeTarget("testUtf8");
-            fail("Invalid characters in file");
-        } catch (BuildException ex) {
-          //TODO assert exception message
-        }
+        buildRule.executeTarget("testUtf8");
+        //TODO assert exception message
     }
 
-    // Tests property element, using XML schema properties as an example.
+    /**
+     * Tests property element, using XML schema properties as an example.
+     */
     @Test
     public void testPropertySchemaForValidXML() {
         buildRule.executeTarget("testProperty.validXML");
     }
 
-    @Test
+    @Test(expected = BuildException.class)
     public void testPropertySchemaForInvalidXML() {
-        try {
-            buildRule.executeTarget("testProperty.invalidXML");
-            fail("XML file does not satisfy schema");
-        } catch (BuildException ex) {
-            //TODO assert exception message
-        }
+        buildRule.executeTarget("testProperty.invalidXML");
+        //TODO assert exception message
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
index 66b4882..334485f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
@@ -23,7 +23,9 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.junit.Assert.fail;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
 
 /**
  * Tests the {@link org.apache.tools.ant.taskdefs.XSLTProcess} task.
@@ -45,14 +47,10 @@ public class XsltTest {
         buildRule.configureProject(TASKDEFS_DIR + "xslt.xml");
     }
 
-    @Test
+    @Test(expected = BuildException.class)
     public void testCatchNoDtd() {
-        try {
-            buildRule.executeTarget("testCatchNoDtd");
-            fail("Expected failure");
-        } catch (BuildException ex) {
-            //TODO assert exception message
-        }
+        buildRule.executeTarget("testCatchNoDtd");
+        // TODO assert exception message
     }
 
     @Test
@@ -76,8 +74,7 @@ public class XsltTest {
     @Test
     public void testStyleSheetWithInclude() {
         buildRule.executeTarget("testStyleSheetWithInclude");
-        if (buildRule.getLog().contains("java.io.FileNotFoundException")) {
-            fail("xsl:include was not found");
-        }
+        assertThat("xsl:include was not found", buildRule.getLog(),
+                not(containsString("java.io.FileNotFoundException")));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
index d2fce93..6558507 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
@@ -29,11 +29,13 @@ import org.apache.tools.ant.types.FileSet;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.both;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 /**
  * Testcase for the Depend optional task.
@@ -48,6 +50,9 @@ public class DependTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         buildRule.configureProject(TEST_BUILD_FILE);
@@ -104,7 +109,6 @@ public class DependTest {
         FileUtilities.rollbackTimestamps(new 
File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
         FileUtilities.rollbackTimestamps(new 
File(buildRule.getProject().getProperty("classes.dir")), 5);
 
-
         buildRule.executeTarget("testinner");
         assertEquals("Depend did not leave correct number of files", 0,
             getResultFiles().size());
@@ -132,12 +136,9 @@ public class DependTest {
      */
     @Test
     public void testNoSource() {
-        try {
-            buildRule.executeTarget("testnosource");
-            fail("Build exception expected: No source specified");
-        } catch (BuildException ex) {
-            assertContains("srcdir attribute must be set", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("srcdir attribute must be set");
+        buildRule.executeTarget("testnosource");
     }
 
     /**
@@ -145,12 +146,9 @@ public class DependTest {
      */
     @Test
     public void testEmptySource() {
-        try {
-            buildRule.executeTarget("testemptysource");
-            fail("Build exception expected: No source specified");
-        } catch (BuildException ex) {
-            assertContains("srcdir attribute must be non-empty", 
ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("srcdir attribute must be non-empty");
+        buildRule.executeTarget("testemptysource");
     }
 
     /**
@@ -201,12 +199,9 @@ public class DependTest {
         FileUtilities.rollbackTimestamps(new 
File(buildRule.getProject().getProperty("classes.dir")), 5);
 
         buildRule.executeTarget("testnonpublic");
-        String log = buildRule.getLog();
-        assertContains("Expected warning about APrivate",
-            "The class APrivate in file", log);
-        assertContains("but has not been deleted because its source file "
-            + "could not be determined",
-            "The class APrivate in file", log);
+        assertThat("Expected warning about APrivate",
+                buildRule.getLog(), both(containsString("The class APrivate in 
file"))
+                        .and(containsString("but has not been deleted because 
its source file could not be determined")));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
index ac1c27c..3fda82c 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
@@ -25,16 +25,17 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 import java.io.File;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
-
 /**
  * Tests the Image task.
  *
@@ -49,6 +50,9 @@ public class ImageTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         /* JAI depends on internal API removed in Java 9 */
@@ -60,13 +64,13 @@ public class ImageTest {
     @Test
     public void testEchoToLog() {
         buildRule.executeTarget("testEchoToLog");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
     }
 
     @Test
     public void testSimpleScale() {
         buildRule.executeTarget("testSimpleScale");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
 
         File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
@@ -75,13 +79,13 @@ public class ImageTest {
     @Test
     public void testOverwriteTrue() {
         buildRule.executeTarget("testSimpleScale");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
         File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         assumeTrue("Could not change file modification date",
                 f.setLastModified(f.lastModified() - 
FILE_UTILS.getFileTimestampGranularity() * 2));
         long lastModified = f.lastModified();
         buildRule.executeTarget("testOverwriteTrue");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
         f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         long overwrittenLastModified = f.lastModified();
         assertTrue("File was not overwritten.", lastModified < 
overwrittenLastModified);
@@ -90,11 +94,11 @@ public class ImageTest {
     @Test
     public void testOverwriteFalse() {
         buildRule.executeTarget("testSimpleScale");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
         File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         long lastModified = f.lastModified();
         buildRule.executeTarget("testOverwriteFalse");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
         f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         long overwrittenLastModified = f.lastModified();
         assertEquals("File was overwritten.", lastModified, 
overwrittenLastModified);
@@ -103,7 +107,7 @@ public class ImageTest {
     @Test
     public void testSimpleScaleWithMapper() {
         buildRule.executeTarget("testSimpleScaleWithMapper");
-        assertContains("Processing File", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Processing File"));
         File f = new File(buildRule.getOutputDir(), "scaled-" + LARGEIMAGE);
         assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
     }
@@ -111,13 +115,13 @@ public class ImageTest {
     @Test
     @Ignore("Previously named in a manner to prevent execution")
     public void testFailOnError() {
+        final String message = "Unable to render RenderedOp for this 
operation.";
+        thrown.expect(RuntimeException.class);
+        thrown.expectMessage(message);
         try {
             buildRule.executeTarget("testFailOnError");
-            assertContains("Unable to process image stream", 
buildRule.getLog());
-        } catch (RuntimeException re) {
-            assertTrue("Run time exception should say 'Unable to process image 
stream'. :"
-                       + re.toString(),
-                    re.toString().contains("Unable to process image stream"));
+        } finally {
+            assertThat(buildRule.getLog(), containsString(message));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
index 5728e92..55d4b07 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
@@ -23,7 +23,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
 
 /**
  * Testcase for the JDepend optional task.
@@ -46,8 +47,7 @@ public class JDependTest {
     @Test
     public void testSimple() {
         buildRule.executeTarget("simple");
-        assertContains("Package: org.apache.tools.ant.util.facade",
-                buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("Package: 
org.apache.tools.ant.util.facade"));
     }
 
     /**
@@ -56,7 +56,7 @@ public class JDependTest {
     @Test
     public void testXml() {
         buildRule.executeTarget("xml");
-        assertContains("<DependsUpon>", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("<DependsUpon>"));
     }
 
     /**
@@ -66,7 +66,7 @@ public class JDependTest {
     @Test
     public void testFork() {
         buildRule.executeTarget("fork");
-        assertContains("Package: org.apache.tools.ant.util.facade", 
buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Package: 
org.apache.tools.ant.util.facade"));
     }
 
     /**
@@ -75,7 +75,7 @@ public class JDependTest {
     @Test
     public void testForkXml() {
         buildRule.executeTarget("fork-xml");
-        assertContains("<DependsUpon>", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("<DependsUpon>"));
     }
 
     /**
@@ -84,7 +84,7 @@ public class JDependTest {
     @Test
     public void testTimeout() {
         buildRule.executeTarget("fork-xml");
-        assertContains("JDepend FAILED - Timed out", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("JDepend FAILED - Timed 
out"));
     }
 
 
@@ -94,7 +94,7 @@ public class JDependTest {
     @Test
     public void testTimeoutNot() {
         buildRule.executeTarget("fork-timeout-not");
-        assertContains("Package: org.apache.tools.ant.util.facade", 
buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("Package: 
org.apache.tools.ant.util.facade"));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
index 99709af..2355b7a 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
@@ -18,9 +18,10 @@
 
 package org.apache.tools.ant.taskdefs.optional.junit;
 
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assume.assumeTrue;
 
 import java.io.ByteArrayInputStream;
@@ -100,21 +101,21 @@ public class JUnitReportTest {
     public void testEmptyFile() {
         buildRule.executeTarget("testEmptyFile");
         assertIndexCreated();
-        assertContains("Required text not found in log", 
XMLResultAggregator.WARNING_EMPTY_FILE, buildRule.getLog());
+        assertThat("Required text not found in log", buildRule.getLog(), 
containsString(XMLResultAggregator.WARNING_EMPTY_FILE));
     }
 
     @Test
     public void testIncompleteFile() {
         buildRule.executeTarget("testIncompleteFile");
         assertIndexCreated();
-        assertContains("Required text not found in log", 
XMLResultAggregator.WARNING_IS_POSSIBLY_CORRUPTED, buildRule.getLog());
+        assertThat("Required text not found in log", buildRule.getLog(), 
containsString(XMLResultAggregator.WARNING_IS_POSSIBLY_CORRUPTED));
     }
 
     @Test
     public void testWrongElement() {
         buildRule.executeTarget("testWrongElement");
         assertIndexCreated();
-        assertContains("Required text not found in log", 
XMLResultAggregator.WARNING_INVALID_ROOT_ELEMENT, buildRule.getLog());
+        assertThat("Required text not found in log", buildRule.getLog(), 
containsString(XMLResultAggregator.WARNING_INVALID_ROOT_ELEMENT));
     }
 
     // Bugzilla Report 34963
@@ -126,8 +127,8 @@ public class JUnitReportTest {
         try {
             r = new FileReader(new File(buildRule.getOutputDir(), 
"html/sampleproject/coins/0_CoinTest.html"));
             String report = FileUtils.readFully(r);
-            assertContains("output must contain <br>:\n" + report, 
"junit.framework.AssertionFailedError: DOEG<br>", report);
-            assertContains("#51049: output must translate line breaks:\n" + 
report, "cur['line.separator'] = '\\r\\n';", report);
+            assertThat("output must contain <br>:\n" + report, report, 
containsString("junit.framework.AssertionFailedError: DOEG<br>"));
+            assertThat("#51049: output must translate line breaks:\n" + 
report, report, containsString("cur['line.separator'] = '\\r\\n';"));
         } finally {
             FileUtils.close(r);
         }
@@ -179,7 +180,7 @@ public class JUnitReportTest {
     @Test
     public void testWithParams() throws Exception {
         buildRule.executeTarget("testWithParams");
-        assertContains("key1=value1,key2=value2", buildRule.getLog());
+        assertThat(buildRule.getLog(), 
containsString("key1=value1,key2=value2"));
         commonIndexFileAssertions();
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
index 6a9a9af..5df984b 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
@@ -17,15 +17,16 @@
  */
 package org.apache.tools.ant.taskdefs.optional.junit;
 
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
-import static org.apache.tools.ant.AntAssert.assertNotContains;
-import static org.apache.tools.ant.AntAssert.assertContains;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
@@ -179,26 +180,26 @@ public class JUnitTaskTest {
                    collectorFile.exists());
         // the passing test cases
         buildRule.executeTarget("A.test01");
-        assertContains("1st run: should run A.test01", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
A.test01"));
         buildRule.executeTarget("B.test05");
-        assertContains("1st run: should run B.test05", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
B.test05"));
         buildRule.executeTarget("B.test06");
-        assertContains("1st run: should run B.test06", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
B.test06"));
         buildRule.executeTarget("C.test07");
-        assertContains("1st run: should run C.test07", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
C.test07"));
         buildRule.executeTarget("C.test08");
-        assertContains("1st run: should run C.test08", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
C.test08"));
         buildRule.executeTarget("C.test09");
-        assertContains("1st run: should run C.test09", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
C.test09"));
         // the failing test cases
         buildRule.executeTarget("A.test02");
-        assertContains("1st run: should run A.test02", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
A.test02"));
         buildRule.executeTarget("A.test03");
-        assertContains("1st run: should run A.test03", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
A.test03"));
         buildRule.executeTarget("B.test04");
-        assertContains("1st run: should run B.test04", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
B.test04"));
         buildRule.executeTarget("D.test10");
-        assertContains("1st run: should run D.test10", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("1st run: should run 
D.test10"));
 
 
         // 2nd junit run: should do only failing tests
@@ -208,26 +209,26 @@ public class JUnitTaskTest {
                    collectorFile.exists());
         // the passing test cases
         buildRule.executeTarget("A.test01");
-        assertNotContains("2nd run: should not run A.test01", 
buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("2nd run: should 
not run A.test01")));
         buildRule.executeTarget("B.test05");
-        assertNotContains("2nd run: should not run A.test05", 
buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("2nd run: should 
not run A.test05")));
         buildRule.executeTarget("B.test06");
-        assertNotContains("2nd run: should not run B.test06", 
buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("2nd run: should 
not run B.test06")));
         buildRule.executeTarget("C.test07");
-        assertNotContains("2nd run: should not run C.test07", 
buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("2nd run: should 
not run C.test07")));
         buildRule.executeTarget("C.test08");
-        assertNotContains("2nd run: should not run C.test08", 
buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("2nd run: should 
not run C.test08")));
         buildRule.executeTarget("C.test09");
-        assertNotContains("2nd run: should not run C.test09", 
buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("2nd run: should 
not run C.test09")));
         // the failing test cases
         buildRule.executeTarget("A.test02");
-        assertContains("2nd run: should run A.test02", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("2nd run: should run 
A.test02"));
         buildRule.executeTarget("A.test03");
-        assertContains("2nd run: should run A.test03", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("2nd run: should run 
A.test03"));
         buildRule.executeTarget("B.test04");
-        assertContains("2nd run: should run B.test04", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("2nd run: should run 
B.test04"));
         buildRule.executeTarget("D.test10");
-        assertContains("2nd run: should run D.test10", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("2nd run: should run 
D.test10"));
 
 
         // "fix" errors in class A
@@ -239,13 +240,13 @@ public class JUnitTaskTest {
                    + "' should exist after the 3rd run.",
                    collectorFile.exists());
         buildRule.executeTarget("A.test02");
-        assertContains("3rd run: should run A.test02", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("3rd run: should run 
A.test02"));
         buildRule.executeTarget("A.test03");
-        assertContains("3rd run: should run A.test03", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("3rd run: should run 
A.test03"));
         buildRule.executeTarget("B.test04");
-        assertContains("3rd run: should run B.test04", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("3rd run: should run 
B.test04"));
         buildRule.executeTarget("D.test10");
-        assertContains("3rd run: should run D.test10", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("3rd run: should run 
D.test10"));
 
 
         // 4rd run: two running tests with errors
@@ -254,12 +255,12 @@ public class JUnitTaskTest {
                    + "' should exist after the 4th run.",
                    collectorFile.exists());
         //TODO: these two statements fail
-        //buildRule.executeTarget("A.test02");assertNotContains("4th run: 
should not run A.test02", buildRule.getOutput());
-        //buildRule.executeTarget("A.test03");assertNotContains("4th run: 
should not run A.test03", buildRule.getOutput());
+        
//buildRule.executeTarget("A.test02");assertThat(buildRule.getOutput(), 
not(containsString("4th run: should not run A.test02")));
+        
//buildRule.executeTarget("A.test03");assertThat(buildRule.getOutput(), 
not(containsString("4th run: should not run A.test03")));
         buildRule.executeTarget("B.test04");
-        assertContains("4th run: should run B.test04", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("4th run: should run 
B.test04"));
         buildRule.executeTarget("D.test10");
-        assertContains("4th run: should run D.test10", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("4th run: should run 
D.test10"));
 
     }
 
@@ -272,16 +273,16 @@ public class JUnitTaskTest {
     @Test
     public void testMultilineAssertsNoFork() {
         buildRule.executeTarget("testMultilineAssertsNoFork");
-        assertNotContains("messaged up", buildRule.getLog());
-        assertNotContains("crashed)", buildRule.getLog());
+        assertThat(buildRule.getLog(), not(containsString("messaged up")));
+        assertThat(buildRule.getLog(), not(containsString("crashed)")));
     }
 
     // Bugzilla Issue 45411
     @Test
     public void testMultilineAssertsFork() {
         buildRule.executeTarget("testMultilineAssertsFork");
-        assertNotContains("messaged up", buildRule.getLog());
-        assertNotContains("crashed)", buildRule.getLog());
+        assertThat(buildRule.getLog(), not(containsString("messaged up")));
+        assertThat(buildRule.getLog(), not(containsString("crashed)")));
     }
 
     private void assertResultFilesExist(String target, String extension) {
@@ -301,8 +302,8 @@ public class JUnitTaskTest {
     }
 
     private void assertNoPrint(String result, String where) {
-        assertNotContains(where + " '" + result + "' must not contain print 
statement",
-                   "print to System.", result);
+        assertThat(where + " '" + result + "' must not contain print 
statement",
+                result, not(containsString("print to System.")));
     }
 
     private void assertOutput() throws IOException {

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
index a4798ef..e9cfd1f 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
@@ -18,8 +18,9 @@
 
 package org.apache.tools.ant.taskdefs.optional.junit;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
 
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
@@ -48,55 +49,55 @@ public class JUnitTestListenerTest {
     public void testFullLogOutput() {
         buildRule.getProject().setProperty("enableEvents", "true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting full log to have BuildListener events",
-                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+        assertThat("expecting full log to have BuildListener events", 
buildRule.getFullLog(),
+                containsString(JUnitTask.TESTLISTENER_PREFIX));
     }
 
     @Test
     public void testNoLogOutput() {
         buildRule.getProject().setProperty("enableEvents", "true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertNotContains("expecting log to not have BuildListener events",
-                JUnitTask.TESTLISTENER_PREFIX, buildRule.getLog());
+        assertThat("expecting log to not have BuildListener events", 
buildRule.getLog(),
+                not(containsString(JUnitTask.TESTLISTENER_PREFIX)));
     }
 
     @Test
     public void testTestCountFired() {
         buildRule.getProject().setProperty("enableEvents", "true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting test count message", 
JUnitTask.TESTLISTENER_PREFIX
-                + "tests to run: ", buildRule.getFullLog());
+        assertThat("expecting test count message", buildRule.getFullLog(),
+                containsString(JUnitTask.TESTLISTENER_PREFIX + "tests to run: 
"));
     }
 
     @Test
     public void testStartTestFired() {
         buildRule.getProject().setProperty("enableEvents", "true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting test started message", 
JUnitTask.TESTLISTENER_PREFIX
-                + "startTest(" + PASS_TEST + ")", buildRule.getFullLog());
+        assertThat("expecting test started message", buildRule.getFullLog(),
+                containsString(JUnitTask.TESTLISTENER_PREFIX + "startTest(" + 
PASS_TEST + ")"));
     }
 
     @Test
     public void testEndTestFired() {
         buildRule.getProject().setProperty("enableEvents", "true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting test ended message", 
JUnitTask.TESTLISTENER_PREFIX
-                + "endTest(" + PASS_TEST + ")", buildRule.getFullLog());
+        assertThat("expecting test ended message", buildRule.getFullLog(),
+                containsString(JUnitTask.TESTLISTENER_PREFIX + "endTest(" + 
PASS_TEST + ")"));
     }
 
     @Test
     public void testNoFullLogOutputByDefault() {
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertNotContains("expecting full log to not have BuildListener 
events",
-                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+        assertThat("expecting full log to not have BuildListener events", 
buildRule.getFullLog(),
+                not(containsString(JUnitTask.TESTLISTENER_PREFIX)));
     }
 
     @Test
     public void testFullLogOutputMagicProperty() {
         
buildRule.getProject().setProperty(JUnitTask.ENABLE_TESTLISTENER_EVENTS, 
"true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting full log to have BuildListener events",
-                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+        assertThat("expecting full log to have BuildListener events", 
buildRule.getFullLog(),
+                containsString(JUnitTask.TESTLISTENER_PREFIX));
     }
 
     @Test
@@ -104,8 +105,8 @@ public class JUnitTestListenerTest {
         
buildRule.getProject().setProperty(JUnitTask.ENABLE_TESTLISTENER_EVENTS, 
"false");
         buildRule.getProject().setProperty("enableEvents", "true");
         buildRule.executeTarget(PASS_TEST_TARGET);
-        assertNotContains("expecting full log to not have BuildListener 
events",
-                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+        assertThat("expecting full log to not have BuildListener events", 
buildRule.getFullLog(),
+                not(containsString(JUnitTask.TESTLISTENER_PREFIX)));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
index e0d65e1..086d17c 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
@@ -28,9 +28,10 @@ import junit.framework.TestSuite;
 import org.apache.tools.ant.BuildException;
 import org.junit.Test;
 
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 /**
@@ -81,7 +82,7 @@ public class JUnitTestRunnerTest {
         runner.run();
         String error = runner.getFormatter().getError();
         assertEquals(error, JUnitTestRunner.ERRORS, runner.getRetCode());
-        assertTrue(error, error.contains("thrown on purpose"));
+        assertThat(error, error, containsString("thrown on purpose"));
     }
 
     // check that something which is not a testcase generates no errors

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
index eb20284..5234e63 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
@@ -18,9 +18,10 @@
 
 package org.apache.tools.ant.taskdefs.optional.junit;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
@@ -41,13 +42,13 @@ public class TearDownOnVmCrashTest {
     public void testNoTeardown() {
         buildRule.executeTarget("testNoTeardown");
         assertEquals("true", buildRule.getProject().getProperty("error"));
-        assertNotContains("tearDown called on Timeout", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), not(containsString("tearDown called 
on Timeout")));
     }
 
     @Test
     public void testTeardown() {
         buildRule.executeTarget("testTeardown");
         assertEquals("true", buildRule.getProject().getProperty("error"));
-        assertContains("tearDown called on Timeout", buildRule.getOutput());
+        assertThat(buildRule.getOutput(), containsString("tearDown called on 
Timeout"));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
index 8d03a72..64674a2 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
@@ -26,7 +26,8 @@ import org.apache.tools.ant.util.FileUtils;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
 
 public class XMLFormatterWithCDATAOnSystemOut {
 
@@ -66,8 +67,8 @@ public class XMLFormatterWithCDATAOnSystemOut {
             buildRule.executeTarget("run-junit");
             File f = buildRule.getProject().resolveFile(REPORT);
             try (FileReader reader = new FileReader(f)) {
-                String content = FileUtils.readFully(reader);
-                
assertTrue(content.contains("</RESPONSE>&#x5d;&#x5d;&gt;</ERROR>"));
+                assertThat(FileUtils.readFully(reader),
+                        containsString("</RESPONSE>&#x5d;&#x5d;&gt;</ERROR>"));
             } finally {
                 f.delete();
             }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
index a2dfe4f..7628b27 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
@@ -17,8 +17,9 @@
  */
 package org.apache.tools.ant.taskdefs.optional.net;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
@@ -212,7 +213,7 @@ public class FTPTest {
     @Test
     public void testGetWithSelector() {
         buildRule.executeTarget("ftp-get-with-selector");
-        assertContains("selectors are not supported in remote filesets", 
buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("selectors are not 
supported in remote filesets"));
         FileSet fsDestination = 
buildRule.getProject().getReference("fileset-destination-without-selector");
         DirectoryScanner dsDestination = 
fsDestination.getDirectoryScanner(buildRule.getProject());
         dsDestination.scan();

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
index 7b2d327..6ba512b 100644
--- 
a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
@@ -24,13 +24,14 @@ import org.apache.tools.ant.types.FileSet;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 import java.io.File;
 
-import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 /**
  * Tests the examples of the &lt;scriptdef&gt; task.
@@ -42,6 +43,9 @@ public class ScriptDefTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         
buildRule.configureProject("src/etc/testcases/taskdefs/optional/script/scriptdef.xml");
@@ -55,31 +59,24 @@ public class ScriptDefTest {
         FileSet fileset = p.getReference("testfileset");
         File baseDir = fileset.getDir(p);
         String log = buildRule.getLog();
-        assertTrue("Expecting attribute value printed",
-                log.contains("Attribute attr1 = test"));
-
-        assertTrue("Expecting nested element value printed",
-                log.contains("Fileset basedir = " + 
baseDir.getAbsolutePath()));
+        assertThat("Expecting attribute value printed", log,
+                containsString("Attribute attr1 = test"));
+        assertThat("Expecting nested element value printed", log,
+                containsString("Fileset basedir = " + 
baseDir.getAbsolutePath()));
     }
 
     @Test
     public void testNoLang() {
-        try {
-            buildRule.executeTarget("nolang");
-            fail("Absence of language attribute not detected");
-        } catch (BuildException ex) {
-            assertContains("requires a language attribute", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("requires a language attribute");
+        buildRule.executeTarget("nolang");
     }
 
     @Test
     public void testNoName() {
-        try {
-            buildRule.executeTarget("noname");
-            fail("Absence of name attribute not detected");
-        } catch (BuildException ex) {
-            assertContains("scriptdef requires a name attribute", 
ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("scriptdef requires a name attribute");
+        buildRule.executeTarget("noname");
     }
 
     @Test
@@ -90,11 +87,10 @@ public class ScriptDefTest {
         FileSet fileset = p.getReference("testfileset");
         File baseDir = fileset.getDir(p);
         String log = buildRule.getLog();
-        assertTrue("Expecting attribute value to be printed",
-                log.contains("Attribute attr1 = test"));
-
-        assertTrue("Expecting nested element value to be printed",
-                log.contains("Fileset basedir = " + 
baseDir.getAbsolutePath()));
+        assertThat("Expecting attribute value to be printed", log,
+                containsString("Attribute attr1 = test"));
+        assertThat("Expecting nested element value to be printed", log,
+                containsString("Fileset basedir = " + 
baseDir.getAbsolutePath()));
     }
 
     @Test
@@ -105,39 +101,31 @@ public class ScriptDefTest {
 
     @Test
     public void testException() {
-        try {
-            buildRule.executeTarget("exception");
-            fail("Should have thrown an exception in the script");
-        } catch (BuildException ex) {
-            assertContains("TypeError", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("TypeError");
+        buildRule.executeTarget("exception");
     }
 
     @Test
     public void testDoubleDef() {
         buildRule.executeTarget("doubledef");
         String log = buildRule.getLog();
-        assertTrue("Task1 did not execute", log.contains("Task1"));
-        assertTrue("Task2 did not execute", log.contains("Task2"));
+        assertThat("Task1 did not execute", log, containsString("Task1"));
+        assertThat("Task2 did not execute", log, containsString("Task2"));
     }
 
     @Test
     public void testDoubleAttribute() {
-        try {
-            buildRule.executeTarget("doubleAttributeDef");
-            fail("Should have detected duplicate attirbute definition");
-        } catch (BuildException ex) {
-            assertContains("attr1 attribute more than once", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("attr1 attribute more than once");
+        buildRule.executeTarget("doubleAttributeDef");
     }
 
     @Test
     public void testProperty() {
         buildRule.executeTarget("property");
-        // get the fileset and its basedir
-        String log = buildRule.getLog();
-        assertTrue("Expecting property in attribute value replaced",
-                log.contains("Attribute value = test"));
+        assertThat("Expecting property in attribute value replaced",
+                buildRule.getLog(), containsString("Attribute value = test"));
     }
 
     @Test
@@ -149,17 +137,11 @@ public class ScriptDefTest {
 
     @Test
     public void testUseSrcAndEncodingFailure() {
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("expected <eacute [\u00e9]> but was <eacute 
[\u00c3\u00a9]>");
         final String readerEncoding = "ISO-8859-1";
         
buildRule.getProject().setProperty("useSrcAndEncoding.reader.encoding", 
readerEncoding);
-        try {
-            buildRule.executeTarget("useSrcAndEncoding");
-            fail("should have failed with reader's encoding [" + 
readerEncoding +
-                "] different from the writer's encoding [" +
-                
buildRule.getProject().getProperty("useSrcAndEncoding.encoding") + "]");
-        } catch (BuildException e) {
-            assertTrue(e.getMessage().matches(
-                    "expected <eacute \\[\u00e9]> but was <eacute 
\\[\u00c3\u00a9]>"));
-        }
+        buildRule.executeTarget("useSrcAndEncoding");
     }
 
     @Test

Reply via email to