diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-03-20 11:30:15 +0100 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-03-20 11:30:20 +0100 |
commit | dd2e1401e5c74ab50a7432964995de87e100d95f (patch) | |
tree | 720b5ec17dfeb5a54811878db4ebc8cdd46f8495 /sonar-ws-client/src/test/java/org | |
parent | 5666d41460c1784d210d32cd9ec8de7b7c039035 (diff) | |
download | sonarqube-dd2e1401e5c74ab50a7432964995de87e100d95f.tar.gz sonarqube-dd2e1401e5c74ab50a7432964995de87e100d95f.zip |
Fix quality flaws
Diffstat (limited to 'sonar-ws-client/src/test/java/org')
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/qualitygate/internal/DefaultQualityGateClientTest.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/qualitygate/internal/DefaultQualityGateClientTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/qualitygate/internal/DefaultQualityGateClientTest.java index ddf9c29e9d4..f6cb803a6a9 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/qualitygate/internal/DefaultQualityGateClientTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/qualitygate/internal/DefaultQualityGateClientTest.java @@ -60,7 +60,7 @@ public class DefaultQualityGateClientTest { HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url()); httpServer.stubResponseBody( - "{\"qualitygates\":[{\"id\":666,\"name\":\"Ninth\"},{\"id\":42,\"name\":\"Golden\"},{\"id\":43,\"name\":\"Star\"}]}"); + "{\"qualitygates\":[{\"id\":666,\"name\":\"Ninth\"},{\"id\":42,\"name\":\"Golden\"},{\"id\":43,\"name\":\"Star\"}],\"default\":42}"); QualityGateClient client = new DefaultQualityGateClient(requestFactory); QualityGates qGates = client.list(); @@ -68,6 +68,22 @@ public class DefaultQualityGateClientTest { assertThat(httpServer.requestedPath()).isEqualTo("/api/qualitygates/list"); assertThat(httpServer.requestParams()).isEmpty(); assertThat(qGates.qualityGates()).hasSize(3); + assertThat(qGates.defaultGate().id()).isEqualTo(42L); + } + + @Test + public void should_list_qualitygates_empty() { + HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url()); + + httpServer.stubResponseBody( + "{}"); + + QualityGateClient client = new DefaultQualityGateClient(requestFactory); + QualityGates qGates = client.list(); + + assertThat(httpServer.requestedPath()).isEqualTo("/api/qualitygates/list"); + assertThat(httpServer.requestParams()).isEmpty(); + assertThat(qGates.qualityGates()).isEmpty(); assertThat(qGates.defaultGate()).isNull(); } |