diff options
author | David Gageot <david@gageot.net> | 2012-06-14 14:15:47 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-06-14 17:31:56 +0200 |
commit | 72afb8a3154d4525d9a956b755d2871a4a5c3d9f (patch) | |
tree | 8536dfee94e0b13ab04b5e6fb575dbdc9724c82d /sonar-squid/src | |
parent | 1cdea962c00d3106c2e64704fde0068d73a110c0 (diff) | |
download | sonarqube-72afb8a3154d4525d9a956b755d2871a4a5c3d9f.tar.gz sonarqube-72afb8a3154d4525d9a956b755d2871a4a5c3d9f.zip |
Remove some violations on unit tests
Took the opportunity to migrate some tests to FestAssert.
Also removed some duplication
Diffstat (limited to 'sonar-squid/src')
-rw-r--r-- | sonar-squid/src/test/java/org/sonar/squid/api/SourceCodeTest.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sonar-squid/src/test/java/org/sonar/squid/api/SourceCodeTest.java b/sonar-squid/src/test/java/org/sonar/squid/api/SourceCodeTest.java index ea4e916a8ae..6e15fb84e80 100644 --- a/sonar-squid/src/test/java/org/sonar/squid/api/SourceCodeTest.java +++ b/sonar-squid/src/test/java/org/sonar/squid/api/SourceCodeTest.java @@ -25,6 +25,7 @@ import org.junit.Test; import org.sonar.squid.measures.Measurable; import org.sonar.squid.measures.Metric; +import static org.fest.assertions.Assertions.assertThat; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -62,12 +63,13 @@ public class SourceCodeTest { @Test public void testEqualsAndHashCode() { - assertFalse((prj.equals(pac))); - assertFalse(prj.hashCode() == pac.hashCode()); - assertFalse(prj.equals(new Object())); + assertThat(prj).isNotEqualTo(pac); + assertThat(prj.hashCode()).isNotEqualTo(pac.hashCode()); + assertThat(prj).isNotEqualTo(new Object()); + SourceCode samePac = new SourcePackage("org.sonar"); - assertEquals(pac, samePac); - assertEquals(pac.hashCode(), samePac.hashCode()); + assertThat(pac).isEqualTo(samePac); + assertThat(pac.hashCode()).isEqualTo(samePac.hashCode()); } @Test @@ -111,7 +113,6 @@ public class SourceCodeTest { assertEquals(file, method.getAncestor(SourceFile.class)); } - @Test public void testHasAmongParents() { assertTrue(cla.hasAmongParents(prj)); |