diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2017-06-01 17:27:41 +0200 |
---|---|---|
committer | Eric Hartmann <hartmann.eric@gmail.com> | 2017-06-14 15:43:12 +0200 |
commit | 380816fec9f40f8d2c25c3f08be2d783b7293226 (patch) | |
tree | 286fef86e8cdd36565d51937294c200e98a88f25 /sonar-ws/src/test | |
parent | 3e26c9b9b44ebabbc2c81e134c26799ce3f4bc3b (diff) | |
download | sonarqube-380816fec9f40f8d2c25c3f08be2d783b7293226.tar.gz sonarqube-380816fec9f40f8d2c25c3f08be2d783b7293226.zip |
SONAR-9303 IT to test built-in profile cannot be modified
Diffstat (limited to 'sonar-ws/src/test')
-rw-r--r-- | sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java index b50ee4a6259..411d4662779 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java @@ -29,9 +29,12 @@ 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.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS; +import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_FROM_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE; +import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY; +import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TO_NAME; public class QualityProfilesServiceTest { @@ -51,6 +54,7 @@ public class QualityProfilesServiceTest { assertThat(serviceTester.getGetParser()).isSameAs(QualityProfiles.SearchWsResponse.parser()); serviceTester.assertThat(getRequest) + .hasPath("search") .hasParam(PARAM_DEFAULTS, true) .hasParam(PARAM_PROJECT_KEY, "project") .hasParam(PARAM_LANGUAGE, "language") @@ -67,6 +71,7 @@ public class QualityProfilesServiceTest { .build()); serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("add_project") .hasParam(PARAM_LANGUAGE, "xoo") .hasParam(PARAM_PROFILE_NAME, "Sonar Way") .hasParam(PARAM_PROJECT_KEY, "sample") @@ -82,6 +87,7 @@ public class QualityProfilesServiceTest { .build()); serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("remove_project") .hasParam(PARAM_LANGUAGE, "xoo") .hasParam(PARAM_PROFILE_NAME, "Sonar Way") .hasParam(PARAM_PROJECT_KEY, "sample") @@ -89,15 +95,47 @@ public class QualityProfilesServiceTest { } @Test - public void create_project() throws Exception { + public void create() throws Exception { underTest.create(CreateRequest.builder() .setLanguage("xoo") .setProfileName("Sonar Way") .build()); serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("create") .hasParam(PARAM_LANGUAGE, "xoo") .hasParam(PARAM_PROFILE_NAME, "Sonar Way") .andNoOtherParam(); } + + @Test + public void copy() throws Exception { + underTest.copy(new CopyRequest("fromKey", "My Sonar Way")); + + serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("copy") + .hasParam(PARAM_FROM_KEY, "fromKey") + .hasParam(PARAM_TO_NAME, "My Sonar Way") + .andNoOtherParam(); + } + + @Test + public void set_default() { + underTest.setDefault(new SetDefaultRequest("sample")); + + serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("set_default") + .hasParam(PARAM_PROFILE_KEY, "sample") + .andNoOtherParam(); + } + + @Test + public void delete() { + underTest.delete(new DeleteRequest("sample")); + + serviceTester.assertThat(serviceTester.getPostRequest()) + .hasPath("delete") + .hasParam(PARAM_PROFILE_KEY, "sample") + .andNoOtherParam(); + } } |