diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-13 17:49:56 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-05-13 17:52:05 +0200 |
commit | 2e31f0fc686d07687251413ef076a07a882f8e2c (patch) | |
tree | 022faf2f12cc0dec8605ec3243f6f770d8ecd5cc /sonar-ws-client/src/test/java/org/sonar | |
parent | d0a41de6bfd7033e6897396e9cbff609c5d5911b (diff) | |
download | sonarqube-2e31f0fc686d07687251413ef076a07a882f8e2c.tar.gz sonarqube-2e31f0fc686d07687251413ef076a07a882f8e2c.zip |
SONAR-4323 add missing unit test
Diffstat (limited to 'sonar-ws-client/src/test/java/org/sonar')
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java | 1 | ||||
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java | 51 |
2 files changed, 52 insertions, 0 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java index 795edf4adab..b559b693dfc 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java @@ -46,6 +46,7 @@ public class DefaultUserClientTest { User simon = users.get(0); assertThat(simon.login()).isEqualTo("simon"); assertThat(simon.name()).isEqualTo("Simon"); + assertThat(simon.email()).isNull(); assertThat(simon.active()).isTrue(); } } diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java new file mode 100644 index 00000000000..752f85c1da4 --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java @@ -0,0 +1,51 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube 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. + * + * SonarQube 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.sonar.wsclient.user; + +import org.junit.Test; + +import java.util.Map; + +import static org.fest.assertions.Assertions.assertThat; + +public class UserQueryTest { + @Test + public void test_params() throws Exception { + UserQuery query = UserQuery.create().includeDeactivated().logins("simon", "loic"); + Map<String, Object> params = query.urlParams(); + + assertThat(params.get("includeDeactivated")).isEqualTo("true"); + assertThat(params.get("logins")).isEqualTo("simon,loic"); + } + + @Test + public void test_empty_params() throws Exception { + UserQuery query = UserQuery.create(); + Map<String, Object> params = query.urlParams(); + + assertThat(params).isEmpty(); + } + + @Test + public void should_replace_logins() throws Exception { + UserQuery query = UserQuery.create().logins("simon").logins("loic"); + assertThat(query.urlParams().get("logins")).isEqualTo("loic"); + } +} |