aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-06-15 16:44:01 +0200
committerDavid Gageot <david@gageot.net>2012-06-15 16:44:01 +0200
commitbe33ec41314feb7b5dea29d56b9855a03455e45a (patch)
treea1e9c4e219bc3edd5cd15fd934c3d6ac965515af /plugins
parent0f580d01542078b59532642add4a0aba7651c79e (diff)
downloadsonarqube-be33ec41314feb7b5dea29d56b9855a03455e45a.tar.gz
sonarqube-be33ec41314feb7b5dea29d56b9855a03455e45a.zip
Remove violations
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmFieldTest.java20
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmMethodTest.java31
2 files changed, 27 insertions, 24 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmFieldTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmFieldTest.java
index 881cb96dab1..36586f6dd28 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmFieldTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmFieldTest.java
@@ -21,9 +21,7 @@ package org.sonar.java.bytecode.asm;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.fest.assertions.Assertions.assertThat;
public class AsmFieldTest {
@@ -31,16 +29,16 @@ public class AsmFieldTest {
private AsmClass numberClass = new AsmClass("java/lang/Number");
@Test
- public void testHashCode() {
- assertTrue(new AsmField(stringClass, "firstField").equals(new AsmField(stringClass, "firstField")));
- assertFalse(new AsmField(stringClass, "firstField").equals(new AsmField(stringClass, "secondField")));
- assertFalse(new AsmField(stringClass, "firstField").equals(new AsmField(numberClass, "firstField")));
+ public void testEquals() {
+ assertThat(new AsmField(stringClass, "firstField")).isEqualTo(new AsmField(stringClass, "firstField"));
+ assertThat(new AsmField(stringClass, "firstField")).isNotEqualTo(new AsmField(stringClass, "secondField"));
+ assertThat(new AsmField(stringClass, "firstField")).isNotEqualTo(new AsmField(numberClass, "firstField"));
}
@Test
- public void testEquals() {
- assertEquals(new AsmField(stringClass, "firstField").hashCode(), new AsmField(stringClass, "firstField").hashCode());
- assertFalse(new AsmField(stringClass, "firstField").hashCode() == new AsmField(stringClass, "secondField").hashCode());
- assertFalse(new AsmField(stringClass, "firstField").hashCode() == new AsmField(numberClass, "firstField").hashCode());
+ public void testHashCode() {
+ assertThat(new AsmField(stringClass, "firstField").hashCode()).isEqualTo(new AsmField(stringClass, "firstField").hashCode());
+ assertThat(new AsmField(stringClass, "firstField").hashCode()).isNotEqualTo(new AsmField(stringClass, "secondField").hashCode());
+ assertThat(new AsmField(stringClass, "firstField").hashCode()).isNotEqualTo(new AsmField(numberClass, "firstField").hashCode());
}
}
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmMethodTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmMethodTest.java
index ace87024eab..e35bd1d409f 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmMethodTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/asm/AsmMethodTest.java
@@ -24,8 +24,13 @@ import org.junit.Test;
import org.sonar.java.ast.SquidTestUtils;
import org.sonar.java.bytecode.ClassLoaderBuilder;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
+import static org.fest.assertions.Assertions.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
public class AsmMethodTest {
@@ -38,7 +43,7 @@ public class AsmMethodTest {
AsmClassProvider asmClassProvider = new AsmClassProviderImpl(ClassLoaderBuilder.create(SquidTestUtils.getFile("/bytecode/bin/")));
javaBean = asmClassProvider.getClass("properties/JavaBean");
}
-
+
@Test
public void testAsmMethod() {
AsmMethod method = new AsmMethod(new AsmClass("java/lang/String"), "toString()Ljava/lang/String;");
@@ -46,19 +51,19 @@ public class AsmMethodTest {
}
@Test
- public void testHashCode() {
- assertTrue(new AsmMethod(stringClass, "firstMethod()V").equals(new AsmMethod(stringClass, "firstMethod()V")));
- assertFalse(new AsmMethod(stringClass, "firstMethod()V").equals(new AsmMethod(stringClass, "secondMethod()V")));
- assertFalse(new AsmMethod(stringClass, "firstMethod()V").equals(new AsmMethod(numberClass, "firstMethod()V")));
+ public void testEquals() {
+ assertThat(new AsmMethod(stringClass, "firstMethod()V")).isEqualTo(new AsmMethod(stringClass, "firstMethod()V"));
+ assertThat(new AsmMethod(stringClass, "firstMethod()V")).isNotEqualTo(new AsmMethod(stringClass, "secondMethod()V"));
+ assertThat(new AsmMethod(stringClass, "firstMethod()V")).isNotEqualTo(new AsmMethod(numberClass, "firstMethod()V"));
}
@Test
- public void testEquals() {
- assertEquals(new AsmMethod(stringClass, "firstMethod()V").hashCode(), new AsmMethod(stringClass, "firstMethod()V").hashCode());
- assertFalse(new AsmMethod(stringClass, "firstMethod()V").hashCode() == new AsmMethod(stringClass, "secondMethod()V").hashCode());
- assertFalse(new AsmMethod(stringClass, "firstMethod()V").hashCode() == new AsmMethod(numberClass, "firstMethod()V").hashCode());
+ public void testHashCode() {
+ assertThat(new AsmMethod(stringClass, "firstMethod()V").hashCode()).isEqualTo(new AsmMethod(stringClass, "firstMethod()V").hashCode());
+ assertThat(new AsmMethod(stringClass, "firstMethod()V").hashCode()).isNotEqualTo(new AsmMethod(stringClass, "secondMethod()V").hashCode());
+ assertThat(new AsmMethod(stringClass, "firstMethod()V").hashCode()).isNotEqualTo(new AsmMethod(numberClass, "firstMethod()V").hashCode());
}
-
+
@Test
public void testIsAccessor() {
assertTrue(javaBean.getMethod("getName()Ljava/lang/String;").isAccessor());
@@ -80,7 +85,7 @@ public class AsmMethodTest {
assertFalse(javaBean.getMethod("recursiveAbsSameIncrementA(I)I").isAccessor());
assertFalse(javaBean.getMethod("recursiveAbsDifferentIncrementA(I)I").isAccessor());
}
-
+
@Test
public void testGetAccessedField() {
assertThat(javaBean.getMethod("getName()Ljava/lang/String;").getAccessedField().getName(), is("name"));