aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-03 14:52:42 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-05 13:09:46 +0100
commite23046ef19a3baa4484320e13a3ac0eaa60195b7 (patch)
treea3a5eb88863819a38b799f8657c4bed8b543393f /sonar-ws
parent0f998ecdd8916c05f73c7c3e780371572c41a622 (diff)
downloadsonarqube-e23046ef19a3baa4484320e13a3ac0eaa60195b7.tar.gz
sonarqube-e23046ef19a3baa4484320e13a3ac0eaa60195b7.zip
SONAR-8235 Return all defined settings in api/settings/values
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java3
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java27
2 files changed, 9 insertions, 21 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java
index 788490a2820..06ac411ddf6 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java
@@ -25,10 +25,8 @@ import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Arrays.asList;
import static java.util.Objects.requireNonNull;
-import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_KEYS;
public class ValuesRequest {
@@ -89,7 +87,6 @@ public class ValuesRequest {
}
public ValuesRequest build() {
- checkArgument(!keys.isEmpty(), "'%s' cannot be empty", PARAM_KEYS);
return new ValuesRequest(this);
}
}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java
index 1ee0d1763bd..3c08fd7142f 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java
@@ -20,7 +20,6 @@
package org.sonarqube.ws.client.setting;
-import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -44,6 +43,15 @@ public class ValuesRequestTest {
}
@Test
+ public void create_request_with_no_keys() {
+ ValuesRequest result = underTest.build();
+
+ assertThat(result.getComponentId()).isNull();
+ assertThat(result.getComponentKey()).isNull();
+ assertThat(result.getKeys()).isEmpty();
+ }
+
+ @Test
public void create_request_with_component_id() {
ValuesRequest result = underTest.setKeys("sonar.debt").setComponentId("projectId").build();
@@ -61,21 +69,4 @@ public class ValuesRequestTest {
assertThat(result.getKeys()).containsOnly("sonar.debt");
}
- @Test
- public void fail_when_keys_is_null() throws Exception {
- expectedException.expect(NullPointerException.class);
- underTest
- .setKeys((List<String>) null)
- .setComponentId("projectId")
- .build();
- }
-
- @Test
- public void fail_when_keys_is_empty() throws Exception {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("'keys' cannot be empty");
-
- underTest.setComponentId("projectId").build();
- }
-
}