### Question:
UserClient { @SuppressWarnings("unchecked") public List<User> get(UserGetParam param) { JSONObject params = JSONObject.fromObject(param, defaultConfig); if (accessor.checkVersion("2.0") < 0) { if (params.containsKey("selectUsrgrps")) { params.put("select_usrgrps", params.remove("selectUsrgrps")); } } JSONArray result = (JSONArray) accessor.execute("user.get", params); JsonConfig config = defaultConfig.copy(); config.setCollectionType(List.class); config.setRootClass(User.class); config.getClassMap().put("usrgrps", Usergroup.class); return (List<User>) JSONArray.toCollection(result, config); } UserClient(ZabbixAccessor accessor, JsonConfig defaultConfig); @SuppressWarnings("unchecked") List<User> get(UserGetParam param); String login(UserAuthenticateParam param); @SuppressWarnings("unchecked") List<String> create(UserCreateParam param); @SuppressWarnings("unchecked") List<String> update(UserUpdateParam param); @SuppressWarnings("unchecked") List<String> delete(List<String> userids);  }### Answer:
@Test public void testGetAll() { UserGetParam param = new UserGetParam(); param.setOutput("extend"); param.setSelectUsrgrps("extend"); List<User> users = client.user().get(param); for (User user : users) { log.trace(ReflectionToStringBuilder.toString(user, ToStringStyle.SHORT_PREFIX_STYLE)); for (Usergroup usergroup : user.getUsrgrps()) { log.trace(" " + ReflectionToStringBuilder.toString(usergroup, ToStringStyle.SHORT_PREFIX_STYLE)); } } assertTrue(users.size() > 0); }
@Test public void testGet() { UserGetParam param = new UserGetParam(); param.setUserids(Arrays.asList("1")); param.setOutput("extend"); param.setSelectUsrgrps("extend"); List<User> users = client.user().get(param); assertEquals(1, users.size()); assertEquals("1", users.get(0).getUserid()); assertTrue(users.get(0).getUsrgrps().size() > 0); }
@Test public void testGetNotExist() { UserGetParam param = new UserGetParam(); param.setUserids(Arrays.asList("999999")); param.setOutput("extend"); List<User> users = client.user().get(param); assertEquals(0, users.size()); }