diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-09 16:56:58 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-11 10:25:37 +0100 |
commit | 3e019c0afb4a3df57ed86fe394a090b75f2d7218 (patch) | |
tree | f4a38a9b9dce181a366da4a9e30fd024f702bb1b /it | |
parent | af5d5ff485d1cd76e76543477488b97695209b8c (diff) | |
download | sonarqube-3e019c0afb4a3df57ed86fe394a090b75f2d7218.tar.gz sonarqube-3e019c0afb4a3df57ed86fe394a090b75f2d7218.zip |
SONAR-7003 Refactor batch issue tracking
Diffstat (limited to 'it')
-rw-r--r-- | it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java index 0b2c75db850..08c9dd04516 100644 --- a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java +++ b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java @@ -64,8 +64,7 @@ public class IssueJsonReportTest { for (Object issue : issues) { JSONObject jsonIssue = (JSONObject) issue; assertThat(jsonIssue.get("startLine")).isNotNull(); - assertThat(jsonIssue.get("endLine")).isNotNull(); - + assertThat(jsonIssue.get("line")).isEqualTo(jsonIssue.get("startLine")); assertThat(jsonIssue.get("endLine")).isEqualTo(jsonIssue.get("startLine")); assertThat(jsonIssue.get("endOffset")).isNotNull(); @@ -97,14 +96,20 @@ public class IssueJsonReportTest { JSONObject obj = ItUtils.getJSONReport(result); JSONArray issues = (JSONArray) obj.get("issues"); - for (Object i : issues) { - JSONObject issue = (JSONObject) i; - assertThat(issue.get("startLine")).isIn(6L, 9L); - assertThat(issue.get("line")).isIn(6L, 9L); - assertThat(issue.get("endLine")).isIn(6L, 15L); - assertThat(issue.get("startOffset")).isIn(27L, 20L); - assertThat(issue.get("endOffset")).isIn(32L, 2L); - } + JSONObject issue1 = (JSONObject) issues.get(0); + JSONObject issue2 = (JSONObject) issues.get(1); + + assertThat(issue1.get("startLine")).isIn(6L); + assertThat(issue1.get("line")).isIn(6L); + assertThat(issue1.get("endLine")).isIn(6L); + assertThat(issue1.get("startOffset")).isIn(27L); + assertThat(issue1.get("endOffset")).isIn(32L); + + assertThat(issue2.get("startLine")).isIn(9L); + assertThat(issue2.get("line")).isIn(9L); + assertThat(issue2.get("endLine")).isIn(15L); + assertThat(issue2.get("startOffset")).isIn(20L); + assertThat(issue2.get("endOffset")).isIn(2L); } @@ -260,13 +265,18 @@ public class IssueJsonReportTest { assertThat(sanitize("5.0.0-5868-SILVER-SNAPSHOT")).isEqualTo("<SONAR_VERSION>"); } - private static String sanitize(String s) { - // sanitize issue uuid keys - s = s.replaceAll("\"[a-zA-Z_0-9\\-]{20}\"", "<ISSUE_KEY>"); + @Test + public void issueSanityCheck() { + assertThat(sanitize("s\"0150F1EBDB8E000003\"f")).isEqualTo("s<ISSUE_KEY>f"); + } + private static String sanitize(String s) { // sanitize sonar version. Note that "-SILVER-SNAPSHOT" is used by Goldeneye jobs s = s.replaceAll("\\d\\.\\d(.\\d)?(\\-.*)?\\-SNAPSHOT", "<SONAR_VERSION>"); + // sanitize issue uuid keys + s = s.replaceAll("\"[a-zA-Z_0-9\\-]{15,20}\"", "<ISSUE_KEY>"); + return ItUtils.sanitizeTimezones(s); } |