Groups { public void move(String openId, int group) { String url = WxEndpoint.get("url.group.user.move"); String json = String.format("{\"openid\":\"%s\",\"to_groupid\":%s}", openId, group); logger.debug("move user group: {}", json); wxClient.post(url, json); }  static Groups defaultGroups(); static Groups with(AppSetting appSetting); void setWxClient(WxClient wxClient); Group create(String name); List<Group> list(); void update(int id, String name); void delete(int id); int getUserGroup(String openId); void move(String openId, int group); void move(List<String> openIds, int group);  }
@Test public void testMove(){ Groups.defaultGroups().move(TestConfiguration.getInstance().testUser(), 0); int group = Groups.defaultGroups().getUserGroup(TestConfiguration.getInstance().testUser()); Assert.assertTrue(group == 0); Groups.defaultGroups().move(TestConfiguration.getInstance().testUser(), 2); group = Groups.defaultGroups().getUserGroup(TestConfiguration.getInstance().testUser()); Assert.assertTrue(group == 2); Groups.defaultGroups().move(TestConfiguration.getInstance().testUser(), 0); }