Replace assert by simpler but equivalent calls.master
@@ -27,8 +27,8 @@ import java.io.ByteArrayOutputStream; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Arrays; | |||||
import static org.junit.Assert.assertArrayEquals; | |||||
import static org.junit.Assert.assertNotEquals; | import static org.junit.Assert.assertNotEquals; | ||||
import static org.junit.Assert.assertNotNull; | import static org.junit.Assert.assertNotNull; | ||||
import static org.junit.Assert.assertTrue; | import static org.junit.Assert.assertTrue; | ||||
@@ -82,9 +82,8 @@ public class ExecStreamRedirectorTest { | |||||
if (dirListingOutput != null) { | if (dirListingOutput != null) { | ||||
// Compare the directory listing that was redirected to these files. | // Compare the directory listing that was redirected to these files. | ||||
// All files should have the same content. | // All files should have the same content. | ||||
assertTrue("Redirected output in file " + redirectedOutputFile + | |||||
" doesn't match content in other redirected output file(s)", | |||||
Arrays.equals(dirListingOutput, redirectedOutput)); | |||||
assertArrayEquals("Redirected output in file " + redirectedOutputFile + | |||||
" doesn't match content in other redirected output file(s)", dirListingOutput, redirectedOutput); | |||||
} | } | ||||
dirListingOutput = redirectedOutput; | dirListingOutput = redirectedOutput; | ||||
} | } | ||||
@@ -22,6 +22,7 @@ import org.junit.Test; | |||||
import static org.junit.Assert.assertEquals; | import static org.junit.Assert.assertEquals; | ||||
import static org.junit.Assert.assertNotEquals; | import static org.junit.Assert.assertNotEquals; | ||||
import static org.junit.Assert.assertNotNull; | |||||
import static org.junit.Assert.assertTrue; | import static org.junit.Assert.assertTrue; | ||||
import static org.junit.Assert.assertFalse; | import static org.junit.Assert.assertFalse; | ||||
@@ -107,10 +108,10 @@ public class DeweyDecimalTest { | |||||
@Test | @Test | ||||
public void equals() { | public void equals() { | ||||
DeweyDecimal dd = new DeweyDecimal("1.2.3"); | DeweyDecimal dd = new DeweyDecimal("1.2.3"); | ||||
assertFalse(dd.equals("other")); | |||||
assertFalse(dd.equals(null)); | |||||
assertTrue(dd.equals(new DeweyDecimal("1.2.3"))); | |||||
assertTrue(dd.equals(new DeweyDecimal("1.2.3.0"))); | |||||
assertNotEquals("other", dd); | |||||
assertNotNull(dd); | |||||
assertEquals(dd, new DeweyDecimal("1.2.3")); | |||||
assertEquals(dd, new DeweyDecimal("1.2.3.0")); | |||||
} | } | ||||
@Test | @Test | ||||
@@ -448,8 +448,7 @@ public class FileUtilsTest { | |||||
.getParent()); | .getParent()); | ||||
tmp2 = getFileUtils().createTempFile("pre", ".suf", parent, false); | tmp2 = getFileUtils().createTempFile("pre", ".suf", parent, false); | ||||
assertTrue("files are different", !tmp1.getAbsolutePath().equals( | |||||
tmp2.getAbsolutePath())); | |||||
assertNotEquals("files are different", tmp1.getAbsolutePath(), tmp2.getAbsolutePath()); | |||||
} | } | ||||
@Test | @Test | ||||
@@ -21,13 +21,13 @@ import junit.framework.TestCase; | |||||
public class MultilineAsserts extends TestCase { | public class MultilineAsserts extends TestCase { | ||||
public void testFoo() { | public void testFoo() { | ||||
assertTrue("testFoo \nmessed up", false); | |||||
fail("testFoo \nmessed up"); | |||||
} | } | ||||
public void testBar() { | public void testBar() { | ||||
assertTrue("testBar \ndidn't work", true); | assertTrue("testBar \ndidn't work", true); | ||||
} | } | ||||
public void testFee() { | public void testFee() { | ||||
assertTrue("testFee \ncrashed", false); | |||||
fail("testFee \ncrashed"); | |||||
} | } | ||||
public void testFie() { | public void testFie() { | ||||
assertTrue("testFie \nbroke", true); | assertTrue("testFie \nbroke", true); | ||||