aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-08-05 16:32:47 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-08-05 16:42:02 +0200
commit105176fb19c3ab8a82eec620abd99b32b1387139 (patch)
treea593e4ed6737fcdd8b1fae3fc0259214a4c48bce /sonar-batch/src
parente2daa5befa8916b585567a942141edcb7eff9a19 (diff)
downloadsonarqube-105176fb19c3ab8a82eec620abd99b32b1387139.tar.gz
sonarqube-105176fb19c3ab8a82eec620abd99b32b1387139.zip
SONAR-6754 Add support of execution flow in Xoo
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java14
-rw-r--r--sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo14
2 files changed, 28 insertions, 0 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java
index 8ba2d4834ba..b5a6cdc14dd 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java
@@ -29,6 +29,7 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.batch.mediumtest.BatchMediumTester;
import org.sonar.batch.mediumtest.TaskResult;
import org.sonar.batch.protocol.input.ActiveRule;
+import org.sonar.batch.protocol.output.BatchReport.ExecutionFlow;
import org.sonar.batch.protocol.output.BatchReport.Issue;
import org.sonar.batch.protocol.output.BatchReport.IssueLocation;
import org.sonar.xoo.XooPlugin;
@@ -120,4 +121,17 @@ public class MultilineIssuesMediumTest {
assertThat(additionalLocation.getTextRange().getEndLine()).isEqualTo(7);
assertThat(additionalLocation.getTextRange().getEndOffset()).isEqualTo(52);
}
+
+ @Test
+ public void testExecutionFlows() throws Exception {
+ List<Issue> issues = result.issuesFor(result.inputFile("xources/hello/WithFlow.xoo"));
+ assertThat(issues).hasSize(1);
+ Issue issue = issues.get(0);
+ assertThat(issue.getExecutionFlowList()).hasSize(1);
+
+ ExecutionFlow executionFlow = issue.getExecutionFlow(0);
+ assertThat(executionFlow.getLocationList()).hasSize(2);
+
+ // TODO more assertions
+ }
}
diff --git a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo
new file mode 100644
index 00000000000..31e11c695e9
--- /dev/null
+++ b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo
@@ -0,0 +1,14 @@
+package hello;
+
+public class HelloJava {
+
+ public static void main(String[] args) {
+ {xoo-start-flow:1:1:1}if (true){xoo-end-flow:1:1:1} {
+ {xoo-start-flow:1:1:2}if (true){xoo-end-flow:1:1:2} {
+ {xoo-start-issue:1:1}if (true){xoo-end-issue:1:1} {
+ System.out.println("Hello");
+ }
+ }
+ }
+ }
+} \ No newline at end of file