diff options
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java | 24 | ||||
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java | 2 |
2 files changed, 26 insertions, 0 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 27ee1da2ee8..feb57e3c984 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 @@ -52,6 +52,7 @@ public class IssueQueryTest { .planned(true) .resolved(true) .sort(IssueQuery.SORT_BY_ASSIGNEE) + .asc(true) .pageSize(10) .pageIndex(2) .requiredRole(UserRole.USER) @@ -72,12 +73,35 @@ public class IssueQueryTest { assertThat(query.planned()).isTrue(); assertThat(query.resolved()).isTrue(); assertThat(query.sort()).isEqualTo(IssueQuery.SORT_BY_ASSIGNEE); + assertThat(query.asc()).isTrue(); assertThat(query.pageSize()).isEqualTo(10); assertThat(query.pageIndex()).isEqualTo(2); assertThat(query.requiredRole()).isEqualTo(UserRole.USER); } @Test + public void should_build_query_without_dates() throws Exception { + IssueQuery query = IssueQuery.builder() + .issueKeys(Lists.newArrayList("ABCDE")) + .build(); + + assertThat(query.issueKeys()).containsOnly("ABCDE"); + assertThat(query.createdAfter()).isNull(); + assertThat(query.createdBefore()).isNull(); + } + + @Test + public void should_throw_exception_if_sort_is_not_valid() throws Exception { + try { + IssueQuery.builder() + .sort("UNKNOWN") + .build(); + } catch (Exception e) { + assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Bad sort field: UNKNOWN"); + } + } + + @Test public void collection_params_should_not_be_null_but_empty() throws Exception { IssueQuery query = IssueQuery.builder() .issueKeys(null) diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java index 2e74730df14..540253a9bd5 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java @@ -48,6 +48,7 @@ public class DefaultActionPlanClientTest { HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url()); httpServer.doReturnBody("{\"actionPlans\": [{\"key\": \"382f6f2e-ad9d-424a-b973-9b065e04348a\",\n" + "\"name\": \"Long term\",\n" + + "\"desc\": \"Long term acton plan\",\n" + "\"status\": \"CLOSED\",\n" + "\"project\": \"com.sonarsource.it.samples:simple-sample\",\n" + "\"userLogin\": \"admin\",\n" + @@ -65,6 +66,7 @@ public class DefaultActionPlanClientTest { ActionPlan actionPlan = actionPlans.get(0); assertThat(actionPlan.key()).isEqualTo("382f6f2e-ad9d-424a-b973-9b065e04348a"); assertThat(actionPlan.name()).isEqualTo("Long term"); + assertThat(actionPlan.description()).isEqualTo("Long term acton plan"); assertThat(actionPlan.project()).isEqualTo("com.sonarsource.it.samples:simple-sample"); assertThat(actionPlan.status()).isEqualTo("CLOSED"); assertThat(actionPlan.userLogin()).isEqualTo("admin"); |