### Question:
UsergroupClient { public List<String> massAdd(UsergroupMassAddParam param) { if (param.getUserids() == null || param.getUserids().isEmpty()) { throw new IllegalArgumentException("userids is required."); } if (param.getUsrgrpids() == null || param.getUsrgrpids().isEmpty()) { throw new IllegalArgumentException("usrgrpids is required."); } JSONObject params = JSONObject.fromObject(param, defaultConfig); JSONObject result = (JSONObject) accessor.execute("usergroup.massAdd", params); JSONArray usrgrpids = result.getJSONArray("usrgrpids"); JsonConfig config = defaultConfig.copy(); config.setCollectionType(List.class); config.setRootClass(String.class); List<?> ids = (List<?>) JSONArray.toCollection(usrgrpids, config); List<String> resultIds = new ArrayList<String>(); for (Object id : ids) { resultIds.add(id.toString()); } return resultIds; } UsergroupClient(ZabbixAccessor accessor, JsonConfig defaultConfig); @SuppressWarnings("unchecked") List<Usergroup> get(UsergroupGetParam param); @SuppressWarnings("unchecked") List<String> create(UsergroupCreateParam param); List<String> massAdd(UsergroupMassAddParam param); @SuppressWarnings("unchecked") List<String> update(UsergroupUpdateParam param); @SuppressWarnings("unchecked") List<String> delete(List<String> usrgrpids);  }### Answer:
@Test public void testMassAdd() { String userid; { UserCreateParam param = new UserCreateParam(); param.setAlias("alias1"); param.setPasswd("passwd1"); Usergroup usergroup = new Usergroup(); usergroup.setUsrgrpid("8"); param.setUsrgrps(Arrays.asList(usergroup)); List<String> userids = client.user().create(param); userid = userids.get(0); } String usrgrpid; { UsergroupCreateParam param = new UsergroupCreateParam(); param.setName("name1"); List<String> usrgrpids = client.usergroup().create(param); usrgrpid = usrgrpids.get(0); } try { { UsergroupMassAddParam param = new UsergroupMassAddParam(); param.setUserids(Arrays.asList(userid)); param.setUsrgrpids(Arrays.asList(usrgrpid)); List<String> usrgrpids = client.usergroup().massAdd(param); assertEquals(1, usrgrpids.size()); assertEquals(usrgrpid, usrgrpids.get(0)); } { UserGetParam param = new UserGetParam(); param.setUserids(Arrays.asList(userid)); param.setOutput("extend"); param.setSelectUsrgrps("extend"); List<User> users = client.user().get(param); assertEquals(1, users.size()); User user = users.get(0); assertEquals(userid, user.getUserid()); assertEquals(2, user.getUsrgrps().size()); assertTrue(Arrays.asList("8", usrgrpid).contains(user.getUsrgrps().get(0).getUsrgrpid())); assertTrue(Arrays.asList("8", usrgrpid).contains(user.getUsrgrps().get(1).getUsrgrpid())); } } finally { client.usergroup().delete(Arrays.asList(usrgrpid)); client.user().delete(Arrays.asList(userid)); } }