Repository: ant
Updated Branches:
  refs/heads/master 102623615 -> 81c3e6e3d


http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java 
b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
index bebf627..88a5572 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
@@ -26,15 +26,19 @@ import org.apache.tools.ant.taskdefs.condition.Condition;
 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.fail;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
 
 public class AddTypeTest {
 
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/types/addtype.xml");
@@ -63,71 +67,65 @@ public class AddTypeTest {
     @Test
     public void testNestedA() {
         buildRule.executeTarget("nested.a");
-        assertContains("add A called", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("add A called"));
     }
 
     @Test
     public void testNestedB() {
         buildRule.executeTarget("nested.b");
-         assertContains("add B called", buildRule.getLog());
+         assertThat(buildRule.getLog(), containsString("add B called"));
     }
 
     @Test
     public void testNestedC() {
         buildRule.executeTarget("nested.c");
-        assertContains("add C called", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("add C called"));
     }
 
     @Test
     public void testNestedAB() {
-        try {
-            buildRule.executeTarget("nested.ab");
-            fail("Build exception expected: Should have got ambiguous");
-        } catch (BuildException ex) {
-            assertContains("ambiguous", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("ambiguous");
+        buildRule.executeTarget("nested.ab");
     }
 
     @Test
     public void testConditionType() {
         buildRule.executeTarget("condition.type");
-        assertContains("beforeafter", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("beforeafter"));
     }
 
     @Test
     public void testConditionTask() {
         buildRule.executeTarget("condition.task");
-        assertContains("My Condition execution", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("My Condition 
execution"));
     }
 
     @Test
     public void testConditionConditionType() {
         buildRule.executeTarget("condition.condition.type");
-        assertContains("My Condition eval", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("My Condition eval"));
     }
 
     @Test
     public void testConditionConditionTask() {
-        try {
-            buildRule.executeTarget("condition.condition.task");
-            fail("Build exception expected: Task masking condition");
-        } catch (BuildException ex) {
-             assertContains("doesn't support the nested", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("doesn't support the nested");
+        buildRule.executeTarget("condition.condition.task");
     }
 
     @Test
     public void testAddConfigured() {
         buildRule.executeTarget("myaddconfigured");
-        assertContains("value is Value Setexecute: value is Value Set",
-                buildRule.getLog());
+        assertThat(buildRule.getLog(),
+                containsString("value is Value Setexecute: value is Value 
Set"));
     }
 
     @Test
     public void testAddConfiguredValue() {
         buildRule.executeTarget("myaddconfiguredvalue");
-        assertContains("value is Value Setexecute: value is Value Set",
-                buildRule.getLog());
+        assertThat(buildRule.getLog(),
+                containsString("value is Value Setexecute: value is Value 
Set"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java 
b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
index f96228f..c3768bf 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
@@ -22,9 +22,10 @@ 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.fail;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assume.assumeFalse;
 
 /**
@@ -35,23 +36,22 @@ public class AssertionsTest {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/types/assertions.xml");
     }
 
-
     /**
      * runs a test and expects an assertion thrown in forked code
      * @param target String
      */
     private void expectAssertion(String target) {
-        try {
-            buildRule.executeTarget(target);
-            fail("BuildException should have been thrown by assertion fail in 
task");
-        } catch (BuildException ex) {
-            assertContains("assertion not thrown in " + target, "Java 
returned: 1", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("Java returned: 1");
+        buildRule.executeTarget(target);
     }
 
     @Test
@@ -91,29 +91,25 @@ public class AssertionsTest {
 
     @Test
     public void testMultipleAssertions() {
-        try {
-            buildRule.executeTarget("test-multiple-assertions");
-            fail("BuildException should have been thrown by assertion fail in 
task");
-        } catch (BuildException ex) {
-            assertContains("multiple assertions rejected", "Only one assertion 
declaration is allowed", ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("Only one assertion declaration is allowed");
+        buildRule.executeTarget("test-multiple-assertions");
     }
 
     @Test
     public void testReferenceAbuse() {
-        try {
-            buildRule.executeTarget("test-reference-abuse");
-            fail("BuildException should have been thrown by reference abuse");
-        } catch (BuildException ex) {
-            assertContains("reference abuse rejected", "You must not specify", 
ex.getMessage());
-        }
+        thrown.expect(BuildException.class);
+        thrown.expectMessage("You must not specify");
+        buildRule.executeTarget("test-reference-abuse");
     }
 
     @Test
     public void testNofork() {
-        assumeFalse("ran Ant tests with -ea and this would fail spuriously", 
AssertionsTest.class.desiredAssertionStatus());
+        assumeFalse("ran Ant tests with -ea and this would fail spuriously",
+                AssertionsTest.class.desiredAssertionStatus());
         buildRule.executeTarget("test-nofork");
-        assertContains("Assertion statements are currently ignored in 
non-forked mode", buildRule.getLog());
+        assertThat(buildRule.getLog(),
+                containsString("Assertion statements are currently ignored in 
non-forked mode"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java 
b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
index 3b13712..596756b 100644
--- a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
@@ -18,18 +18,21 @@
 
 package org.apache.tools.ant.types;
 
-
 import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.io.File;
+
+import static org.hamcrest.Matchers.containsString;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 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.Assert.fail;
 
 /**
  * JUnit testcases for org.apache.tools.ant.CommandlineJava
@@ -93,8 +96,7 @@ public class CommandlineJavaTest {
         //        assertEquals("with classpath", "java", s[0]);
         assertEquals("with classpath", "-Djava.compiler=NONE", s[1]);
         assertEquals("with classpath", "-classpath", s[2]);
-        assertTrue("build.xml contained",
-                s[3].contains("build.xml" + java.io.File.pathSeparator));
+        assertThat("build.xml contained", s[3], containsString("build.xml" + 
File.pathSeparator));
         assertTrue("ant.jar contained", s[3].endsWith("ant.jar"));
         assertEquals("with classpath", "junit.textui.TestRunner", s[4]);
         assertEquals("with classpath",

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/PathTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PathTest.java 
b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
index b75e9f5..46ac37e 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PathTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
@@ -27,7 +27,9 @@ import org.apache.tools.ant.taskdefs.condition.Os;
 import org.junit.Before;
 import org.junit.Test;
 
+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;
 
@@ -572,7 +574,7 @@ public class PathTest {
             assertEquals(0, p.list().length);
         } catch (BuildException x) {
             String m = x.toString();
-            assertTrue(m, m.contains("circular"));
+            assertThat(m, m, containsString("circular"));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java 
b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
index f0589f1..b42d577 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
@@ -25,7 +25,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;
 
 public class PolyTest {
 
@@ -40,25 +41,25 @@ public class PolyTest {
     @Test
     public void testFileSet() {
         buildRule.executeTarget("fileset");
-        assertContains("types.FileSet", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("types.FileSet"));
     }
 
     @Test
     public void testFileSetAntType() {
         buildRule.executeTarget("fileset-ant-type");
-        assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
+        assertThat(buildRule.getLog(), 
containsString("types.PolyTest$MyFileSet"));
     }
 
     @Test
     public void testPath() {
         buildRule.executeTarget("path");
-        assertContains("types.Path", buildRule.getLog());
+        assertThat(buildRule.getLog(), containsString("types.Path"));
     }
 
     @Test
     public void testPathAntType() {
         buildRule.executeTarget("path-ant-type");
-        assertContains("types.PolyTest$MyPath", buildRule.getLog());
+        assertThat(buildRule.getLog(), 
containsString("types.PolyTest$MyPath"));
     }
 
     public static class MyFileSet extends FileSet {

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java 
b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
index 0b10e33..db1c4f8 100644
--- a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
@@ -24,7 +24,9 @@ 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.both;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -73,9 +75,8 @@ public class RedirectorElementTest {
     @Test
     public void testLogInputString() {
         buildRule.executeTarget("testLogInputString");
-        if (buildRule.getLog().contains("testLogInputString can-cat")) {
-            assertContains("Using input string", buildRule.getFullLog());
-        }
+        assertThat(buildRule.getFullLog(), 
both(containsString("testLogInputString can-cat"))
+                .and(containsString("Using input string")));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java 
b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
index a75a663..d1a8fe1 100644
--- 
a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.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;
 import static org.junit.Assert.fail;
 
 /**
@@ -45,7 +46,7 @@ public class ScriptSelectorTest {
             buildRule.executeTarget("testNolanguage");
             fail("Absence of language attribute not detected");
         } catch (BuildException ex) {
-            assertContains("script language must be specified", 
ex.getMessage());
+            assertThat(ex.getMessage(), containsString("script language must 
be specified"));
 
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
 
b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
index f8c8e6c..7d7b00e 100644
--- 
a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
@@ -46,11 +46,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.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeNotNull;
@@ -184,7 +185,8 @@ public class ModifiedSelectorTest {
 
             assertNotNull("'fs.full.value' must be set.", fsFullValue);
             assertNotEquals("'fs.full.value' must not be null.", "", 
fsFullValue);
-            assertTrue("'fs.full.value' must contain ant.bat.", 
fsFullValue.contains("ant.bat"));
+            assertThat("'fs.full.value' must contain ant.bat.", fsFullValue,
+                    containsString("ant.bat"));
 
             assertNotNull("'fs.mod.value' must be set.", fsModValue);
             // must be empty according to the Mock* implementations
@@ -569,7 +571,7 @@ public class ModifiedSelectorTest {
     public void testResourceSelectorSelresTrue() {
         BFT bft = new BFT();
         bft.doTarget("modifiedselectortest-ResourceSelresTrue");
-        assertContains("does not provide an InputStream", bft.getLog());
+        assertThat(bft.getLog(), containsString("does not provide an 
InputStream"));
         bft.deleteCachefile();
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/81c3e6e3/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java 
b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
index f12f9aa..3aa8559 100644
--- 
a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
@@ -26,8 +26,10 @@ import java.util.Properties;
 
 import org.junit.Test;
 
+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.assertThat;
 import static org.junit.Assert.assertTrue;
 
 public class LayoutPreservingPropertiesTest {
@@ -60,8 +62,8 @@ public class LayoutPreservingPropertiesTest {
 
         // and now make sure that the comments made it into the new file
         String s = readFile(tmp);
-        assertTrue("missing comment", s.contains("# a comment"));
-        assertTrue("missing comment", s.contains("! more comment"));
+        assertThat("missing comment", s, containsString(("# a comment")));
+        assertThat("missing comment", s, containsString(("! more comment")));
     }
 
     /**
@@ -90,16 +92,15 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertTrue(s.contains("\\ prop\\ one\\ =\\ \\ leading and trailing"
-                + " spaces "));
-        assertTrue(s.contains("prop\\ttwo=contains\\ttab"));
-        assertTrue(s.contains("prop\\nthree=contains\\nnewline"));
-        assertTrue(s.contains("prop\\rfour=contains\\rcarriage return"));
-        assertTrue(s.contains("prop\\\\six=contains\\\\backslash"));
-        assertTrue(s.contains("prop\\:seven=contains\\:colon"));
-        assertTrue(s.contains("prop\\=eight=contains\\=equals"));
-        assertTrue(s.contains("prop\\#nine=contains\\#hash"));
-        assertTrue(s.contains("prop\\!ten=contains\\!exclamation"));
+        assertThat(s, containsString("\\ prop\\ one\\ =\\ \\ leading and 
trailing spaces "));
+        assertThat(s, containsString("prop\\ttwo=contains\\ttab"));
+        assertThat(s, containsString("prop\\nthree=contains\\nnewline"));
+        assertThat(s, containsString("prop\\rfour=contains\\rcarriage 
return"));
+        assertThat(s, containsString("prop\\\\six=contains\\\\backslash"));
+        assertThat(s, containsString("prop\\:seven=contains\\:colon"));
+        assertThat(s, containsString("prop\\=eight=contains\\=equals"));
+        assertThat(s, containsString("prop\\#nine=contains\\#hash"));
+        assertThat(s, containsString("prop\\!ten=contains\\!exclamation"));
     }
 
     /**
@@ -126,13 +127,12 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertFalse(s.contains("\\ prop\\ one\\ =\\ \\ leading and"
-                + " trailing spaces "));
-        assertTrue(s.contains("\\ prop\\ one\\ =new one"));
-        assertFalse(s.contains("prop\\ttwo=contains\\ttab"));
-        assertTrue(s.contains("prop\\ttwo=new two"));
-        assertFalse(s.contains("prop\\nthree=contains\\nnewline"));
-        assertTrue(s.contains("prop\\nthree=new three"));
+        assertThat(s, not(containsString("\\ prop\\ one\\ =\\ \\ leading and 
trailing spaces ")));
+        assertThat(s, containsString("\\ prop\\ one\\ =new one"));
+        assertThat(s, not(containsString("prop\\ttwo=contains\\ttab")));
+        assertThat(s, containsString("prop\\ttwo=new two"));
+        assertThat(s, not(containsString("prop\\nthree=contains\\nnewline")));
+        assertThat(s, containsString("prop\\nthree=new three"));
     }
 
     @Test
@@ -172,13 +172,13 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertFalse("should have had no properties ", 
s.contains("prop.alpha"));
-        assertFalse("should have had no properties ", s.contains("prop.beta"));
-        assertFalse("should have had no properties ", 
s.contains("prop.gamma"));
+        assertThat("should have had no properties ", s, 
not(containsString(("prop.alpha"))));
+        assertThat("should have had no properties ", s, 
not(containsString(("prop.beta"))));
+        assertThat("should have had no properties ", s, 
not(containsString(("prop.gamma"))));
 
-        assertFalse("should have had no comments", s.contains("# a comment"));
-        assertFalse("should have had no comments", s.contains("! more 
comment"));
-        assertFalse("should have had no comments", s.contains("# now a line 
wrapping one"));
+        assertThat("should have had no comments", s, not(containsString(("# a 
comment"))));
+        assertThat("should have had no comments", s, not(containsString(("! 
more comment"))));
+        assertThat("should have had no comments", s, not(containsString(("# 
now a line wrapping one"))));
     }
 
     @Test
@@ -198,9 +198,8 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertFalse("should not have had prop.beta", s.contains("prop.beta"));
-        assertTrue("should have had prop.beta's comment",
-                s.contains("! more comment"));
+        assertThat("should not have had prop.beta", s, 
not(containsString(("prop.beta"))));
+        assertThat("should have had prop.beta's comment", s, containsString("! 
more comment"));
     }
 
     @Test
@@ -222,8 +221,8 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertFalse("should not have had prop.beta", s.contains("prop.beta"));
-        assertFalse("should not have had prop.beta's comment", s.contains("! 
more comment"));
+        assertThat("should not have had prop.beta", s, 
not(containsString(("prop.beta"))));
+        assertThat("should not have had prop.beta's comment", s, 
not(containsString(("! more comment"))));
     }
 
     @Test
@@ -254,13 +253,12 @@ public class LayoutPreservingPropertiesTest {
         String s2 = readFile(tmp2);
 
         // check original is untouched
-        assertTrue("should have had 'simple'", s1.contains("simple"));
-        assertFalse("should not have had prop.new", s1.contains("prop.new"));
+        assertThat("should have had 'simple'", s1, containsString(("simple")));
+        assertThat("should not have had prop.new", s1, 
not(containsString(("prop.new"))));
 
         // check clone has the changes
-        assertTrue("should have had 'a new value for beta'",
-                s2.contains("a new value for beta"));
-        assertTrue("should have had prop.new", s2.contains("prop.new"));
+        assertThat("should have had 'a new value for beta'", s2, 
containsString(("a new value for beta")));
+        assertThat("should have had prop.new", s2, 
containsString(("prop.new")));
     }
 
     @Test
@@ -285,16 +283,16 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertTrue(s.contains("prop\\:seven=new value for seven"));
-        assertTrue(s.contains("prop\\=eight=new value for eight"));
-        assertTrue(s.contains("prop\\ eleven=new value for eleven"));
-        assertTrue(s.contains("alpha=new value for alpha"));
-        assertTrue(s.contains("beta=new value for beta"));
+        assertThat(s, containsString("prop\\:seven=new value for seven"));
+        assertThat(s, containsString("prop\\=eight=new value for eight"));
+        assertThat(s, containsString("prop\\ eleven=new value for eleven"));
+        assertThat(s, containsString("alpha=new value for alpha"));
+        assertThat(s, containsString("beta=new value for beta"));
 
-        assertFalse(s.contains("prop\\:seven=contains\\:colon"));
-        assertFalse(s.contains("prop\\=eight=contains\\=equals"));
-        assertFalse(s.contains("alpha:set with a colon"));
-        assertFalse(s.contains("beta set with a space"));
+        assertThat(s, not(containsString("prop\\:seven=contains\\:colon")));
+        assertThat(s, not(containsString("prop\\=eight=contains\\=equals")));
+        assertThat(s, not(containsString("alpha:set with a colon")));
+        assertThat(s, not(containsString("beta set with a space")));
     }
 
     private static String readFile(File f) throws IOException {

Reply via email to