@Test public void addMembersTest() { testUserGroupRepository .addGroupMembers(mockGroup.getGroupId(), testMemberIds); ArgumentCaptor<GroupMembership> gmCaptor = ArgumentCaptor.forClass(GroupMembership.class); verify(mockUserGroupDao, times(2)).save(gmCaptor.capture()); List<GroupMembership> gms = gmCaptor.getAllValues(); assertTrue(gms.get(0).getGroupId() == mockGroup.getGroupId()); assertTrue(gms.get(1).getGroupId() == mockGroup.getGroupId()); assertTrue(gms.get(0).getUserId() == 7654); assertTrue(gms.get(1).getUserId() == 8765); }
public void addGroupMembers(int groupId, int[] members) { for (int i = 0; i < members.length; i++) { GroupMembership gms = new GroupMembership(members[i], groupId); userGroupDao.save(gms); } }
UserGroupRepository { public void addGroupMembers(int groupId, int[] members) { for (int i = 0; i < members.length; i++) { GroupMembership gms = new GroupMembership(members[i], groupId); userGroupDao.save(gms); } } }
UserGroupRepository { public void addGroupMembers(int groupId, int[] members) { for (int i = 0; i < members.length; i++) { GroupMembership gms = new GroupMembership(members[i], groupId); userGroupDao.save(gms); } } UserGroupRepository(UserGroupDao userGroupDao,
                               UserDao userDao,
                               EventDao eventDao,
                               ChatDao chatDao,
                               RequestEncoder encoder,
                               Handler backgroundHandler); }
UserGroupRepository { public void addGroupMembers(int groupId, int[] members) { for (int i = 0; i < members.length; i++) { GroupMembership gms = new GroupMembership(members[i], groupId); userGroupDao.save(gms); } } UserGroupRepository(UserGroupDao userGroupDao,
                               UserDao userDao,
                               EventDao eventDao,
                               ChatDao chatDao,
                               RequestEncoder encoder,
                               Handler backgroundHandler); LiveData<UserGroup> getGroupLiveData(int id); UserGroup getGroup(int id); LiveData<PagedList<UserGroup>> getGroups(); LiveData<List<UserGroup>> getGroupsInList(); LiveData<List<User>> getGroupMembers(int groupId); void setIsSharing(int groupId, boolean isSharing); void addGroup(UserGroup group); void leaveGroup(UserGroup group); void removeGroup(UserGroup group); void addGroupMembers(int groupId, int[] members); void removeGroupMembers(int groupId, int[] members); void updateGroupMembers(int groupId, int[] newMembers); void updateGroup(UserGroup userGroup); void updateMembership(GroupMembership membership); void requestAddGroup(String groupName, int... members); void requestAddMembersToGroup(int groupId, int... members); void requestKickMembers(int groupId, int... members); void requestNameChange(int groupId, String newName); void requestRefresh(); void deleteAllGroups(); void deleteAllMemberships(); }
UserGroupRepository { public void addGroupMembers(int groupId, int[] members) { for (int i = 0; i < members.length; i++) { GroupMembership gms = new GroupMembership(members[i], groupId); userGroupDao.save(gms); } } UserGroupRepository(UserGroupDao userGroupDao,
                               UserDao userDao,
                               EventDao eventDao,
                               ChatDao chatDao,
                               RequestEncoder encoder,
                               Handler backgroundHandler); LiveData<UserGroup> getGroupLiveData(int id); UserGroup getGroup(int id); LiveData<PagedList<UserGroup>> getGroups(); LiveData<List<UserGroup>> getGroupsInList(); LiveData<List<User>> getGroupMembers(int groupId); void setIsSharing(int groupId, boolean isSharing); void addGroup(UserGroup group); void leaveGroup(UserGroup group); void removeGroup(UserGroup group); void addGroupMembers(int groupId, int[] members); void removeGroupMembers(int groupId, int[] members); void updateGroupMembers(int groupId, int[] newMembers); void updateGroup(UserGroup userGroup); void updateMembership(GroupMembership membership); void requestAddGroup(String groupName, int... members); void requestAddMembersToGroup(int groupId, int... members); void requestKickMembers(int groupId, int... members); void requestNameChange(int groupId, String newName); void requestRefresh(); void deleteAllGroups(); void deleteAllMemberships();  }