aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/test
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-08-04 11:52:07 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 10:55:10 +0200
commit4f500d461015eb6edc471677961c72e8e68b87bf (patch)
tree753c67161e57eacad4cbca554d268ef46581dc11 /sonar-ws/src/test
parenta307775b34efbbc4641b01c55aa1aa9465f7f004 (diff)
downloadsonarqube-4f500d461015eb6edc471677961c72e8e68b87bf.tar.gz
sonarqube-4f500d461015eb6edc471677961c72e8e68b87bf.zip
SONAR-9616 Support branch in api/measures/component
Diffstat (limited to 'sonar-ws/src/test')
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
index b83ac53ce90..b42cc3e45ad 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
@@ -25,6 +25,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.ws.WsMeasures;
import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse;
+import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.ServiceTester;
import org.sonarqube.ws.client.WsConnector;
@@ -35,6 +36,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
+import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
+import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
@@ -77,6 +80,35 @@ public class MeasuresServiceTest {
private MeasuresService underTest = serviceTester.getInstanceUnderTest();
@Test
+ public void component() {
+ ComponentWsRequest request = new ComponentWsRequest()
+ .setComponentId(VALUE_BASE_COMPONENT_ID)
+ .setComponentKey(VALUE_BASE_COMPONENT_KEY)
+ .setComponent(VALUE_BASE_COMPONENT_KEY)
+ .setBranch("my_branch")
+ .setMetricKeys(VALUE_METRIC_KEYS)
+ .setAdditionalFields(VALUE_ADDITIONAL_FIELDS)
+ .setMetricKeys(VALUE_METRICS)
+ .setDeveloperId(VALUE_DEVELOPER_ID)
+ .setDeveloperKey(VALUE_DEVELOPER_KEY);
+
+ underTest.component(request);
+ GetRequest getRequest = serviceTester.getGetRequest();
+
+ assertThat(serviceTester.getGetParser()).isSameAs(ComponentWsResponse.parser());
+ serviceTester.assertThat(getRequest)
+ .hasParam(DEPRECATED_PARAM_COMPONENT_ID, VALUE_BASE_COMPONENT_ID)
+ .hasParam(DEPRECATED_PARAM_COMPONENT_KEY, VALUE_BASE_COMPONENT_KEY)
+ .hasParam(PARAM_COMPONENT, VALUE_BASE_COMPONENT_KEY)
+ .hasParam(PARAM_BRANCH, "my_branch")
+ .hasParam(PARAM_METRIC_KEYS, "ncloc,complexity")
+ .hasParam(PARAM_ADDITIONAL_FIELDS, "metrics")
+ .hasParam(PARAM_DEVELOPER_ID, VALUE_DEVELOPER_ID)
+ .hasParam(PARAM_DEVELOPER_KEY, VALUE_DEVELOPER_KEY)
+ .andNoOtherParam();
+ }
+
+ @Test
public void component_tree() {
ComponentTreeWsRequest componentTreeRequest = new ComponentTreeWsRequest()
.setBaseComponentId(VALUE_BASE_COMPONENT_ID)