### Question:
JCUser extends User { @VisibleForTesting static Group copyUserGroup(Group group, JCUser user) { if (group == null) { throw new IllegalArgumentException("User group should not be null"); } Group copy = new Group(group.getName(), group.getDescription()); copy.setId(group.getId()); copy.setUuid(group.getUuid()); copy.getUsers().add(user); return copy; } protected  JCUser();  JCUser(String username, String email, String password); void updateLastLoginTime(); void addContact(UserContact contact); void removeContact(UserContact contact); String getSignature(); void setSignature(String content); int getPostCount(); void setPostCount(int postCount); Language getLanguage(); void setLanguage(Language language); int getPageSize(); void setPageSize(int pageSize); String getLocation(); void setLocation(String location); DateTime getRegistrationDate(); void setRegistrationDate(DateTime registrationDate); Set<UserContact> getContacts(); boolean isEnabled(); void setEnabled(boolean enabled); boolean isAutosubscribe(); void setAutosubscribe(boolean autosubscribe); boolean isMentioningNotificationsEnabled(); void setMentioningNotificationsEnabled(boolean mentioningNotificationsEnabled); boolean isAnonymous(); boolean isSendPmNotification(); void setSendPmNotification(boolean sendPmNotification); DateTime getAvatarLastModificationTime(); void setAvatarLastModificationTime(DateTime avatarLastModificationTime); DateTime getAllForumMarkedAsReadTime(); void setAllForumMarkedAsReadTime(DateTime forumMarkedAsAllReadTime); JCUser addGroup(Group group); JCUser deleteGroup(Group group); List<Long> getGroupsIDs(); static JCUser copyUser(JCUser user); static final int MAX_SIGNATURE_SIZE; static final int MAX_LOCATION_SIZE; static final int DEFAULT_PAGE_SIZE; static final int[] PAGE_SIZES_AVAILABLE; }### Answer:
@Test public void copyUserGroupShouldCopyCorrectlyIfOnlyRequiredFieldsFilled() { Group group = new Group("name"); JCUser user = new JCUser("username", "email@mail.com", "pass"); Group copy = JCUser.copyUserGroup(group, user); assertNotSame(group, copy); assertUserGroupEqualsIgnoreUsers(copy, group); assertEquals(copy.getUsers().size(), 1); assertSame(copy.getUsers().get(0), user); }
@Test public void copyUserGroupShouldCopyCorrectlyIfAllFieldsFilled() { Group group = new Group("name", "description"); group.setId(1); group.setUuid("uuid"); List<User> users = Arrays.asList(new User("username", "email@mail.com", "pass"), new User("username1", "email1@mail.com", "pass1")); group.setUsers(users); JCUser newUser = new JCUser("username", "email@mail.com", "pass"); Group copy = JCUser.copyUserGroup(group, newUser); assertNotSame(copy, group); assertUserGroupEqualsIgnoreUsers(copy, group); assertEquals(copy.getUsers().size(), 1); assertSame(copy.getUsers().get(0), newUser); }