diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-01-23 21:46:20 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-01-23 22:35:31 +0100 |
commit | 078cff8c82b9b3f4bb31f6c014d0bb96f7a1b46a (patch) | |
tree | 922e24dcbb9851acc26d7bef40376f9dc3f786ce /sonar-testing-harness/src/test/java | |
parent | d8a9891950228b8b5d66803e5be1263b756fb9e8 (diff) | |
download | sonarqube-078cff8c82b9b3f4bb31f6c014d0bb96f7a1b46a.tar.gz sonarqube-078cff8c82b9b3f4bb31f6c014d0bb96f7a1b46a.zip |
Sanitize sonar-testing-harness
Diffstat (limited to 'sonar-testing-harness/src/test/java')
-rw-r--r-- | sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java b/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java index e9c492e9c7c..8e1737d737b 100644 --- a/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java +++ b/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java @@ -19,11 +19,7 @@ */ package org.sonar.test; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.sonar.test.TestUtils.assertExists; +import static org.fest.assertions.Assertions.assertThat; import static org.sonar.test.TestUtils.assertSimilarXml; import static org.sonar.test.TestUtils.getResource; import static org.sonar.test.TestUtils.getTestTempDir; @@ -39,36 +35,34 @@ public class TestUtilsTest { @Test public void testResource() { File file = getResource("org/sonar/test/TestUtilsTest/getResource/foo.txt"); - TestUtils.assertExists(file); + assertThat(file).exists(); file = getResource("/org/sonar/test/TestUtilsTest/getResource/foo.txt"); - TestUtils.assertExists(file); + assertThat(file).exists(); file = getResource(getClass(), "getResource/foo.txt"); - TestUtils.assertExists(file); + assertThat(file).exists(); } @Test public void testResourceNotFound() { File file = getResource("org/sonar/test/TestUtilsTest/unknown.txt"); - assertNull(file); + assertThat(file).isNull(); } @Test public void testTempDir() throws Exception { File dir = getTestTempDir(getClass(), "testTempDir"); - assertExists(dir); - assertThat(dir.isDirectory(), is(true)); - assertThat(dir.listFiles().length, is(0)); + assertThat(dir).exists().isDirectory(); + assertThat(dir.listFiles()).isEmpty(); FileUtils.writeStringToFile(new File(dir, "bar.txt"), "some text"); - assertThat(dir.listFiles().length, is(1)); + assertThat(dir.listFiles()).hasSize(1); // the directory is cleaned dir = getTestTempDir(getClass(), "testTempDir"); - TestUtils.assertExists(dir); - assertThat(dir.isDirectory(), is(true)); - assertThat(dir.listFiles().length, is(0)); + assertThat(dir).exists().isDirectory(); + assertThat(dir.listFiles()).isEmpty(); } @Test @@ -82,12 +76,12 @@ public class TestUtilsTest { assertSimilarXml("<foo> <bar /> </foo>", "<foo><bar/></foo>"); // attribute values are checked - assertFalse(isSimilarXml("<foo id='1' />", "<foo id='2'/>").similar()); + assertThat(isSimilarXml("<foo id='1' />", "<foo id='2'/>").similar()).isFalse(); // different xml - assertFalse(isSimilarXml("<foo id='1' />", "<foo id='2'/>").similar()); + assertThat(isSimilarXml("<foo id='1' />", "<foo id='2'/>").similar()).isFalse(); // order of nodes is important - assertFalse(isSimilarXml("<foo><bar id='1' /><bar id='2' /></foo>", "<foo><bar id='2' /><bar id='1' /></foo>").similar()); + assertThat(isSimilarXml("<foo><bar id='1' /><bar id='2' /></foo>", "<foo><bar id='2' /><bar id='1' /></foo>").similar()).isFalse(); } } |