diff options
Diffstat (limited to 'sonar-ws-client/src/test/java')
-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"); + } +} |