diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-08-04 16:21:31 +0200 |
---|---|---|
committer | Janos Gyerik <janos.gyerik@sonarsource.com> | 2017-09-12 10:55:10 +0200 |
commit | 0d284868d5b3901b0e381ea79661e6db9e963c05 (patch) | |
tree | 52ff55b651f3438b89725aa8cf4a0c9ce3326a5b /sonar-ws/src/test | |
parent | 3a3a8bc2c2b14d02484512273e85d017da60a0c4 (diff) | |
download | sonarqube-0d284868d5b3901b0e381ea79661e6db9e963c05.tar.gz sonarqube-0d284868d5b3901b0e381ea79661e6db9e963c05.zip |
SONAR-9616 Create service for api/project_branches/list WS
Diffstat (limited to 'sonar-ws/src/test')
-rw-r--r-- | sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java new file mode 100644 index 00000000000..c3dbc7c581b --- /dev/null +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java @@ -0,0 +1,54 @@ +/* + * 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.projectbranches; + +import org.junit.Rule; +import org.junit.Test; +import org.sonarqube.ws.WsBranches.ListWsResponse; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.ServiceTester; +import org.sonarqube.ws.client.WsConnector; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; + +public class ProjectBranchesServiceTest { + + @Rule + public ServiceTester<ProjectBranchesService> serviceTester = new ServiceTester<>(new ProjectBranchesService(mock(WsConnector.class))); + + private ProjectBranchesService underTest = serviceTester.getInstanceUnderTest(); + + @Test + public void list() { + underTest.list("projectKey"); + + assertThat(serviceTester.getGetParser()).isSameAs(ListWsResponse.parser()); + + GetRequest getRequest = serviceTester.getGetRequest(); + serviceTester.assertThat(getRequest) + .hasPath("list") + .hasParam(PARAM_PROJECT, "projectKey") + .andNoOtherParam(); + } + +} |