aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/test
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-11-23 22:53:45 +0100
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-11-29 20:24:11 +0100
commite1588798acce44a0fcb4e99a1104d62b0ae8d271 (patch)
treea3214dc4244a7b7c670fbcbca420871ffc8cd338 /sonar-ws/src/test
parent097cd25c9e4012da091c71718e9cc067b31098a3 (diff)
downloadsonarqube-e1588798acce44a0fcb4e99a1104d62b0ae8d271.tar.gz
sonarqube-e1588798acce44a0fcb4e99a1104d62b0ae8d271.zip
Generate client for api/user_groups
Diffstat (limited to 'sonar-ws/src/test')
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java143
1 files changed, 0 insertions, 143 deletions
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java
deleted file mode 100644
index d4bac214257..00000000000
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/usergroup/UserGroupsServiceTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-package org.sonarqube.ws.client.usergroup;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.UserGroups.CreateWsResponse;
-import static org.sonarqube.ws.UserGroups.SearchWsResponse;
-import static org.sonarqube.ws.UserGroups.UpdateWsResponse;
-
-public class UserGroupsServiceTest {
-
- @Rule
- public ServiceTester<UserGroupsService> serviceTester = new ServiceTester<>(new UserGroupsService(mock(WsConnector.class)));
-
- private UserGroupsService underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void create() {
- underTest.create(CreateWsRequest.builder()
- .setName("sonar-users")
- .setDescription("All users")
- .setOrganization("org")
- .build());
-
- assertThat(serviceTester.getPostParser()).isSameAs(CreateWsResponse.parser());
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasParam("name", "sonar-users")
- .hasParam("description", "All users")
- .hasParam("organization", "org")
- .andNoOtherParam();
- }
-
- @Test
- public void update() {
- underTest.update(UpdateWsRequest.builder()
- .setId(10L)
- .setName("sonar-users")
- .setDescription("All users")
- .build());
-
- assertThat(serviceTester.getPostParser()).isSameAs(UpdateWsResponse.parser());
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasParam("id", "10")
- .hasParam("name", "sonar-users")
- .hasParam("description", "All users")
- .andNoOtherParam();
- }
-
- @Test
- public void delete() {
- underTest.delete(DeleteWsRequest.builder()
- .setId(10L)
- .setName("sonar-users")
- .setOrganization("orga")
- .build());
-
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasParam("id", "10")
- .hasParam("name", "sonar-users")
- .hasParam("organization", "orga")
- .andNoOtherParam();
- }
-
- @Test
- public void addUser() throws Exception {
- underTest.addUser(AddUserWsRequest.builder()
- .setId(10L)
- .setName("sonar-users")
- .setLogin("john")
- .setOrganization("org")
- .build());
-
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasParam("id", "10")
- .hasParam("name", "sonar-users")
- .hasParam("login", "john")
- .hasParam("organization", "org")
- .andNoOtherParam();
- }
-
- @Test
- public void removeUser() throws Exception {
- underTest.removeUser(RemoveUserWsRequest.builder()
- .setId(10L)
- .setName("sonar-users")
- .setLogin("john")
- .setOrganization("org")
- .build());
-
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasParam("id", "10")
- .hasParam("name", "sonar-users")
- .hasParam("login", "john")
- .hasParam("organization", "org")
- .andNoOtherParam();
- }
-
- @Test
- public void search() {
- underTest.search(SearchWsRequest.builder()
- .setQuery("sonar-users")
- .setPage(10)
- .setPageSize(50)
- .setOrganization("orga")
- .setFields(asList("name", "description"))
- .build());
-
- assertThat(serviceTester.getGetParser()).isSameAs(SearchWsResponse.parser());
- serviceTester.assertThat(serviceTester.getGetRequest())
- .hasParam("q", "sonar-users")
- .hasParam("p", 10)
- .hasParam("ps", 50)
- .hasParam("organization", "orga")
- .hasParam("f", "name,description")
- .andNoOtherParam();
- }
-
-}