aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-squid-java-plugin/src/test
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-11-23 18:52:32 +0000
committerGodin <mandrikov@gmail.com>2010-11-23 18:52:32 +0000
commit9f8394b46a01f7ddac672afddd546ed6e82ccd7e (patch)
tree7645d0433f864c383f0509725000469724bcd81e /plugins/sonar-squid-java-plugin/src/test
parentbb2cd28550c5c33d82473c7b8fb5fdadea80976f (diff)
downloadsonarqube-9f8394b46a01f7ddac672afddd546ed6e82ccd7e.tar.gz
sonarqube-9f8394b46a01f7ddac672afddd546ed6e82ccd7e.zip
SONAR-1845, SONAR-1931: Create a new Squid rules to check class and method complexity
Diffstat (limited to 'plugins/sonar-squid-java-plugin/src/test')
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/ClassComplexityCheckTest.java (renamed from plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/check/ClassComplexityCheckTest.java)6
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/DITCheckTest.java (renamed from plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/check/DITCheckTest.java)6
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/MethodComplexityCheckTest.java (renamed from plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/check/MethodComplexityCheckTest.java)6
3 files changed, 14 insertions, 4 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/check/ClassComplexityCheckTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/ClassComplexityCheckTest.java
index 39692969332..24f7f02f261 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/check/ClassComplexityCheckTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/ClassComplexityCheckTest.java
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.java.ast.check;
+package org.sonar.java.squid.check;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
@@ -28,9 +28,11 @@ import org.junit.Before;
import org.junit.Test;
import org.sonar.java.ast.JavaAstScanner;
import org.sonar.java.squid.JavaSquidConfiguration;
+import org.sonar.java.squid.SquidScanner;
import org.sonar.squid.Squid;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
+import org.sonar.squid.measures.Metric;
public class ClassComplexityCheckTest {
@@ -45,6 +47,8 @@ public class ClassComplexityCheckTest {
JavaAstScanner scanner = squid.register(JavaAstScanner.class);
scanner.scanFile(getFile("/metrics/branches/NoBranches.java"));
scanner.scanFile(getFile("/metrics/branches/ComplexBranches.java"));
+ squid.decorateSourceCodeTreeWith(Metric.values());
+ squid.register(SquidScanner.class).scan();
}
@Test
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/check/DITCheckTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/DITCheckTest.java
index bbe16d51117..51e9a215704 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/bytecode/check/DITCheckTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/DITCheckTest.java
@@ -1,4 +1,4 @@
-package org.sonar.java.bytecode.check;
+package org.sonar.java.squid.check;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
@@ -9,6 +9,7 @@ import org.junit.Test;
import org.sonar.java.ast.JavaAstScanner;
import org.sonar.java.bytecode.BytecodeScanner;
import org.sonar.java.squid.JavaSquidConfiguration;
+import org.sonar.java.squid.SquidScanner;
import org.sonar.squid.Squid;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
@@ -20,11 +21,12 @@ public class DITCheckTest {
@BeforeClass
public static void setup() {
squid = new Squid(new JavaSquidConfiguration());
- squid.register(JavaAstScanner.class).scanDirectory(getFile("/bytecode/unusedProtectedMethod/src"));
DITCheck check = new DITCheck();
check.setMax(1);
squid.registerVisitor(check);
+ squid.register(JavaAstScanner.class).scanDirectory(getFile("/bytecode/unusedProtectedMethod/src"));
squid.register(BytecodeScanner.class).scanDirectory(getFile("/bytecode/unusedProtectedMethod/bin"));
+ squid.register(SquidScanner.class).scan();
}
@Test
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/check/MethodComplexityCheckTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/MethodComplexityCheckTest.java
index 5f8a73396bd..5533ca8e18d 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/check/MethodComplexityCheckTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/squid/check/MethodComplexityCheckTest.java
@@ -1,4 +1,4 @@
-package org.sonar.java.ast.check;
+package org.sonar.java.squid.check;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
@@ -8,9 +8,11 @@ import org.junit.Before;
import org.junit.Test;
import org.sonar.java.ast.JavaAstScanner;
import org.sonar.java.squid.JavaSquidConfiguration;
+import org.sonar.java.squid.SquidScanner;
import org.sonar.squid.Squid;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
+import org.sonar.squid.measures.Metric;
public class MethodComplexityCheckTest {
private Squid squid;
@@ -23,6 +25,8 @@ public class MethodComplexityCheckTest {
squid.registerVisitor(check);
JavaAstScanner scanner = squid.register(JavaAstScanner.class);
scanner.scanFile(getFile("/metrics/branches/ComplexBranches.java"));
+ squid.decorateSourceCodeTreeWith(Metric.values());
+ squid.register(SquidScanner.class).scan();
}
@Test