diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-08-05 16:32:47 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-08-05 16:42:02 +0200 |
commit | 105176fb19c3ab8a82eec620abd99b32b1387139 (patch) | |
tree | a593e4ed6737fcdd8b1fae3fc0259214a4c48bce /sonar-batch/src | |
parent | e2daa5befa8916b585567a942141edcb7eff9a19 (diff) | |
download | sonarqube-105176fb19c3ab8a82eec620abd99b32b1387139.tar.gz sonarqube-105176fb19c3ab8a82eec620abd99b32b1387139.zip |
SONAR-6754 Add support of execution flow in Xoo
Diffstat (limited to 'sonar-batch/src')
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 |