aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-09-13 16:40:42 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-09-13 16:40:42 +0200
commit9033014604e9d537068485b0c71c685eac34d721 (patch)
tree88c5882f0e95278a6a89328f26b382a113739571 /sonar-ws
parentceee11e53f739cb887e70fa654e0963f763dd4c5 (diff)
parenta56e60d168802ff9dc23ffec978bb412fd501f97 (diff)
downloadsonarqube-9033014604e9d537068485b0c71c685eac34d721.tar.gz
sonarqube-9033014604e9d537068485b0c71c685eac34d721.zip
Merge commit 'a56e60d168802ff9dc23ffec978bb412fd501f97'
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequest.java110
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfileWsParameters.java41
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java42
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequest.java110
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequestTest.java68
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java90
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequestTest.java68
7 files changed, 523 insertions, 6 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequest.java
new file mode 100644
index 00000000000..8e6c7f8d6cb
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequest.java
@@ -0,0 +1,110 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.qualityprofile;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+public class AddProjectRequest {
+
+ private final String language;
+ private final String profileName;
+ private final String profileKey;
+ private final String projectKey;
+ private final String projectUuid;
+
+ public AddProjectRequest(Builder builder) {
+ this.language = builder.language;
+ this.profileName = builder.profileName;
+ this.profileKey = builder.profileKey;
+ this.projectKey = builder.projectKey;
+ this.projectUuid = builder.projectUuid;
+ }
+
+ @CheckForNull
+ public String getLanguage() {
+ return language;
+ }
+
+ @CheckForNull
+ public String getProfileName() {
+ return profileName;
+ }
+
+ @CheckForNull
+ public String getProfileKey() {
+ return profileKey;
+ }
+
+ @CheckForNull
+ public String getProjectKey() {
+ return projectKey;
+ }
+
+ @CheckForNull
+ public String getProjectUuid() {
+ return projectUuid;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String language;
+ private String profileName;
+ private String profileKey;
+ private String projectKey;
+ private String projectUuid;
+
+ private Builder() {
+ // enforce factory method use
+ }
+
+ public Builder setLanguage(@Nullable String language) {
+ this.language = language;
+ return this;
+ }
+
+ public Builder setProfileName(@Nullable String profileName) {
+ this.profileName = profileName;
+ return this;
+ }
+
+ public Builder setProfileKey(@Nullable String profileKey) {
+ this.profileKey = profileKey;
+ return this;
+ }
+
+ public Builder setProjectKey(@Nullable String projectKey) {
+ this.projectKey = projectKey;
+ return this;
+ }
+
+ public Builder setProjectUuid(@Nullable String projectUuid) {
+ this.projectUuid = projectUuid;
+ return this;
+ }
+
+ public AddProjectRequest build() {
+ return new AddProjectRequest(this);
+ }
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfileWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfileWsParameters.java
new file mode 100644
index 00000000000..8d75d163c4d
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfileWsParameters.java
@@ -0,0 +1,41 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.qualityprofile;
+
+public class QualityProfileWsParameters {
+
+ public static final String CONTROLLER_QUALITY_PROFILES = "api/qualityprofiles";
+
+ public static final String ACTION_SEARCH = "search";
+ public static final String ACTION_ADD_PROJECT = "add_project";
+ public static final String ACTION_REMOVE_PROJECT = "remove_project";
+
+ public static final String PARAM_DEFAULTS = "defaults";
+ public static final String PARAM_LANGUAGE = "language";
+ public static final String PARAM_PROFILE_NAME = "profileName";
+ public static final String PARAM_PROFILE_KEY = "profileKey";
+ public static final String PARAM_PROJECT_KEY = "projectKey";
+ public static final String PARAM_PROJECT_UUID = "projectUuid";
+
+ private QualityProfileWsParameters() {
+ // Only static stuff
+ }
+
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java
index 0dd4a4beada..f9256557011 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java
@@ -22,22 +22,52 @@ package org.sonarqube.ws.client.qualityprofile;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_ADD_PROJECT;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_REMOVE_PROJECT;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_SEARCH;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.CONTROLLER_QUALITY_PROFILES;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS;
+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_PROJECT_UUID;
+
public class QualityProfilesService extends BaseService {
public QualityProfilesService(WsConnector wsConnector) {
- super(wsConnector, "api/qualityprofiles");
+ super(wsConnector, CONTROLLER_QUALITY_PROFILES);
}
public SearchWsResponse search(SearchWsRequest request) {
return call(
- new GetRequest(path("search"))
- .setParam("defaults", request.getDefaults())
- .setParam("language", request.getLanguage())
- .setParam("profileName", request.getProfileName())
- .setParam("projectKey", request.getProjectKey()),
+ new GetRequest(path(ACTION_SEARCH))
+ .setParam(PARAM_DEFAULTS, request.getDefaults())
+ .setParam(PARAM_LANGUAGE, request.getLanguage())
+ .setParam(PARAM_PROFILE_NAME, request.getProfileName())
+ .setParam(PARAM_PROJECT_KEY, request.getProjectKey()),
SearchWsResponse.parser());
}
+ public void addProject(AddProjectRequest request) {
+ call(new PostRequest(path(ACTION_ADD_PROJECT))
+ .setParam(PARAM_LANGUAGE, request.getLanguage())
+ .setParam(PARAM_PROFILE_NAME, request.getProfileName())
+ .setParam(PARAM_PROFILE_KEY, request.getProfileKey())
+ .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
+ .setParam(PARAM_PROJECT_UUID, request.getProjectUuid()));
+ }
+
+ public void removeProject(RemoveProjectRequest request) {
+ call(new PostRequest(path(ACTION_REMOVE_PROJECT))
+ .setParam(PARAM_LANGUAGE, request.getLanguage())
+ .setParam(PARAM_PROFILE_NAME, request.getProfileName())
+ .setParam(PARAM_PROFILE_KEY, request.getProfileKey())
+ .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
+ .setParam(PARAM_PROJECT_UUID, request.getProjectUuid()));
+ }
+
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequest.java
new file mode 100644
index 00000000000..2dd936066f9
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequest.java
@@ -0,0 +1,110 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.qualityprofile;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+public class RemoveProjectRequest {
+
+ private final String language;
+ private final String profileName;
+ private final String profileKey;
+ private final String projectKey;
+ private final String projectUuid;
+
+ public RemoveProjectRequest(Builder builder) {
+ this.language = builder.language;
+ this.profileName = builder.profileName;
+ this.profileKey = builder.profileKey;
+ this.projectKey = builder.projectKey;
+ this.projectUuid = builder.projectUuid;
+ }
+
+ @CheckForNull
+ public String getLanguage() {
+ return language;
+ }
+
+ @CheckForNull
+ public String getProfileName() {
+ return profileName;
+ }
+
+ @CheckForNull
+ public String getProfileKey() {
+ return profileKey;
+ }
+
+ @CheckForNull
+ public String getProjectKey() {
+ return projectKey;
+ }
+
+ @CheckForNull
+ public String getProjectUuid() {
+ return projectUuid;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String language;
+ private String profileName;
+ private String profileKey;
+ private String projectKey;
+ private String projectUuid;
+
+ private Builder() {
+ // enforce factory method use
+ }
+
+ public Builder setLanguage(@Nullable String language) {
+ this.language = language;
+ return this;
+ }
+
+ public Builder setProfileName(@Nullable String profileName) {
+ this.profileName = profileName;
+ return this;
+ }
+
+ public Builder setProfileKey(@Nullable String profileKey) {
+ this.profileKey = profileKey;
+ return this;
+ }
+
+ public Builder setProjectKey(@Nullable String projectKey) {
+ this.projectKey = projectKey;
+ return this;
+ }
+
+ public Builder setProjectUuid(@Nullable String projectUuid) {
+ this.projectUuid = projectUuid;
+ return this;
+ }
+
+ public RemoveProjectRequest build() {
+ return new RemoveProjectRequest(this);
+ }
+ }
+}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequestTest.java
new file mode 100644
index 00000000000..b8f38de4326
--- /dev/null
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequestTest.java
@@ -0,0 +1,68 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.qualityprofile;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class AddProjectRequestTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ AddProjectRequest.Builder underTest = AddProjectRequest.builder();
+
+ @Test
+ public void create_request_from_profile_key_and_project_key() {
+ AddProjectRequest result = underTest.setProfileKey("SonarWay").setProjectKey("sample").build();
+
+ assertThat(result.getLanguage()).isNull();
+ assertThat(result.getProfileKey()).isEqualTo("SonarWay");
+ assertThat(result.getProfileName()).isNull();
+ assertThat(result.getProjectKey()).isEqualTo("sample");
+ assertThat(result.getProjectUuid()).isNull();
+ }
+
+ @Test
+ public void create_request_from_profile_name_and_language_and_project_key() {
+ AddProjectRequest result = underTest.setLanguage("xoo").setProfileName("Sonar Way").setProjectKey("sample").build();
+
+ assertThat(result.getLanguage()).isEqualTo("xoo");
+ assertThat(result.getProfileKey()).isNull();
+ assertThat(result.getProfileName()).isEqualTo("Sonar Way");
+ assertThat(result.getProjectKey()).isEqualTo("sample");
+ assertThat(result.getProjectUuid()).isNull();
+ }
+
+ @Test
+ public void create_request_from_profile_key_and_project_uuid() {
+ AddProjectRequest result = underTest.setProfileKey("SonarWay").setProjectUuid("123").build();
+
+ assertThat(result.getLanguage()).isNull();
+ assertThat(result.getProfileKey()).isEqualTo("SonarWay");
+ assertThat(result.getProfileName()).isNull();
+ assertThat(result.getProjectKey()).isNull();
+ assertThat(result.getProjectUuid()).isEqualTo("123");
+ }
+
+}
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
new file mode 100644
index 00000000000..91ddb86ef69
--- /dev/null
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java
@@ -0,0 +1,90 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.qualityprofile;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonarqube.ws.QualityProfiles;
+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.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
+
+public class QualityProfilesServiceTest {
+
+ @Rule
+ public ServiceTester<QualityProfilesService> serviceTester = new ServiceTester<>(new QualityProfilesService(mock(WsConnector.class)));
+
+ private QualityProfilesService underTest = serviceTester.getInstanceUnderTest();
+
+ @Test
+ public void search() {
+ underTest.search(new SearchWsRequest()
+ .setDefaults(true)
+ .setProjectKey("project")
+ .setLanguage("language")
+ .setProfileName("profile"));
+ GetRequest getRequest = serviceTester.getGetRequest();
+
+ assertThat(serviceTester.getGetParser()).isSameAs(QualityProfiles.SearchWsResponse.parser());
+ serviceTester.assertThat(getRequest)
+ .hasParam(PARAM_DEFAULTS, true)
+ .hasParam(PARAM_PROJECT_KEY, "project")
+ .hasParam(PARAM_LANGUAGE, "language")
+ .hasParam(PARAM_PROFILE_NAME, "profile")
+ .andNoOtherParam();
+ }
+
+ @Test
+ public void add_project() throws Exception {
+ underTest.addProject(AddProjectRequest.builder()
+ .setLanguage("xoo")
+ .setProfileName("Sonar Way")
+ .setProjectKey("sample")
+ .build());
+
+ serviceTester.assertThat(serviceTester.getPostRequest())
+ .hasParam(PARAM_LANGUAGE, "xoo")
+ .hasParam(PARAM_PROFILE_NAME, "Sonar Way")
+ .hasParam(PARAM_PROJECT_KEY, "sample")
+ .andNoOtherParam();
+ }
+
+ @Test
+ public void remove_project() throws Exception {
+ underTest.removeProject(RemoveProjectRequest.builder()
+ .setLanguage("xoo")
+ .setProfileName("Sonar Way")
+ .setProjectKey("sample")
+ .build());
+
+ serviceTester.assertThat(serviceTester.getPostRequest())
+ .hasParam(PARAM_LANGUAGE, "xoo")
+ .hasParam(PARAM_PROFILE_NAME, "Sonar Way")
+ .hasParam(PARAM_PROJECT_KEY, "sample")
+ .andNoOtherParam();
+ }
+}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequestTest.java
new file mode 100644
index 00000000000..d09892bf528
--- /dev/null
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequestTest.java
@@ -0,0 +1,68 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.qualityprofile;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class RemoveProjectRequestTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ RemoveProjectRequest.Builder underTest = RemoveProjectRequest.builder();
+
+ @Test
+ public void create_request_from_profile_key_and_project_key() {
+ RemoveProjectRequest result = underTest.setProfileKey("SonarWay").setProjectKey("sample").build();
+
+ assertThat(result.getLanguage()).isNull();
+ assertThat(result.getProfileKey()).isEqualTo("SonarWay");
+ assertThat(result.getProfileName()).isNull();
+ assertThat(result.getProjectKey()).isEqualTo("sample");
+ assertThat(result.getProjectUuid()).isNull();
+ }
+
+ @Test
+ public void create_request_from_profile_name_and_language_and_project_key() {
+ RemoveProjectRequest result = underTest.setLanguage("xoo").setProfileName("Sonar Way").setProjectKey("sample").build();
+
+ assertThat(result.getLanguage()).isEqualTo("xoo");
+ assertThat(result.getProfileKey()).isNull();
+ assertThat(result.getProfileName()).isEqualTo("Sonar Way");
+ assertThat(result.getProjectKey()).isEqualTo("sample");
+ assertThat(result.getProjectUuid()).isNull();
+ }
+
+ @Test
+ public void create_request_from_profile_key_and_project_uuid() {
+ RemoveProjectRequest result = underTest.setProfileKey("SonarWay").setProjectUuid("123").build();
+
+ assertThat(result.getLanguage()).isNull();
+ assertThat(result.getProfileKey()).isEqualTo("SonarWay");
+ assertThat(result.getProfileName()).isNull();
+ assertThat(result.getProjectKey()).isNull();
+ assertThat(result.getProjectUuid()).isEqualTo("123");
+ }
+
+}