@Test public void test_empty_params() throws Exception { UserQuery query = UserQuery.create(); Map<String, Object> params = query.urlParams(); assertThat(params).isEmpty(); }
public NCIUser getNCIUser(String username) { UserQuery userQuery = new UserQuery(this.dataSource); NCIUser user = (NCIUser) userQuery.findObject(username); if (user != null) user.setContextsByRole(this.getContextsForAllRoles(user.getUsername(), "QUEST_CONTENT")); return user; }
@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 should_search_by_text() throws Exception { UserQuery query = UserQuery.create().searchText("sim"); assertThat(query.urlParams().get("s")).isEqualTo("sim"); }
@Test public void should_replace_logins() throws Exception { UserQuery query = UserQuery.create().logins("simon").logins("loic"); assertThat(query.urlParams().get("logins")).isEqualTo("loic"); }