diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-06-28 19:27:42 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-06-28 19:27:42 +0200 |
commit | 8d64596363ee3240147b30af70f6a0c2220ad7be (patch) | |
tree | 24b2e6706725644ec27f5d2d321ac874c8026230 /sonar-plugin-api/src | |
parent | d5d08e962a70d4b9a25f5b36b869b905e32de189 (diff) | |
download | sonarqube-8d64596363ee3240147b30af70f6a0c2220ad7be.tar.gz sonarqube-8d64596363ee3240147b30af70f6a0c2220ad7be.zip |
SONAR-4421 Remove empty actions and issues from bulk change parameters
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java index feb57e3c984..adac4a108bd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java @@ -19,7 +19,6 @@ */ package org.sonar.api.issue; -import com.google.common.collect.Lists; import org.junit.Test; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.Severity; @@ -27,7 +26,9 @@ import org.sonar.api.web.UserRole; import java.util.Arrays; import java.util.Date; +import java.util.List; +import static com.google.common.collect.Lists.newArrayList; import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Fail.fail; @@ -36,16 +37,16 @@ public class IssueQueryTest { @Test public void should_build_query() throws Exception { IssueQuery query = IssueQuery.builder() - .issueKeys(Lists.newArrayList("ABCDE")) - .severities(Lists.newArrayList(Severity.BLOCKER)) - .statuses(Lists.newArrayList(Issue.STATUS_RESOLVED)) - .resolutions(Lists.newArrayList(Issue.RESOLUTION_FALSE_POSITIVE)) - .components(Lists.newArrayList("org/struts/Action.java")) - .componentRoots(Lists.newArrayList("org.struts:core")) - .rules(Lists.newArrayList(RuleKey.of("squid", "AvoidCycle"))) - .actionPlans(Lists.newArrayList("AP1", "AP2")) - .reporters(Lists.newArrayList("crunky")) - .assignees(Lists.newArrayList("gargantua")) + .issueKeys(newArrayList("ABCDE")) + .severities(newArrayList(Severity.BLOCKER)) + .statuses(newArrayList(Issue.STATUS_RESOLVED)) + .resolutions(newArrayList(Issue.RESOLUTION_FALSE_POSITIVE)) + .components(newArrayList("org/struts/Action.java")) + .componentRoots(newArrayList("org.struts:core")) + .rules(newArrayList(RuleKey.of("squid", "AvoidCycle"))) + .actionPlans(newArrayList("AP1", "AP2")) + .reporters(newArrayList("crunky")) + .assignees(newArrayList("gargantua")) .assigned(true) .createdAfter(new Date()) .createdBefore(new Date()) @@ -82,7 +83,7 @@ public class IssueQueryTest { @Test public void should_build_query_without_dates() throws Exception { IssueQuery query = IssueQuery.builder() - .issueKeys(Lists.newArrayList("ABCDE")) + .issueKeys(newArrayList("ABCDE")) .build(); assertThat(query.issueKeys()).containsOnly("ABCDE"); @@ -196,6 +197,22 @@ public class IssueQueryTest { } @Test + public void number_of_issue_keys_should_be_limited() throws Exception { + List<String> issueKeys = newArrayList(); + for (int i=0; i<IssueQuery.MAX_ISSUE_KEYS; i++) { + issueKeys.add("issue-key-"+ i); + } + try { + IssueQuery.builder() + .issueKeys(issueKeys) + .build(); + fail(); + } catch (Exception e) { + assertThat(e).hasMessage("Number of issue keys must be less than 500 (got 500)").isInstanceOf(IllegalArgumentException.class); + } + } + + @Test public void should_accept_null_sort() throws Exception { IssueQuery query = IssueQuery.builder().sort(null).build(); assertThat(query.sort()).isNull(); |