### Question:
JCUser extends User { public static JCUser copyUser(JCUser user) { if (user == null) { throw new IllegalArgumentException("User should not be null"); } JCUser copy = new JCUser(user.getUsername(), user.getEmail(), user.getPassword()); copy.setId(user.getId()); copy.setFirstName(user.getFirstName()); copy.setLastName(user.getLastName()); copy.setLastLogin(user.getLastLogin()); copy.setBanReason(user.getBanReason()); copy.setRole(user.getRole()); copy.setEncodedUsername(user.getEncodedUsername()); copy.setAvatar(user.getAvatar()); copy.setVersion(user.getVersion()); for (Group group : user.getGroups()) { copy.getGroups().add(copyUserGroup(group,copy)); } copy.setSalt(user.getSalt()); copy.setPostCount(user.getPostCount()); copy.setLanguage(user.getLanguage()); copy.setPageSize(user.getPageSize()); copy.setLocation(user.getLocation()); copy.setSignature(user.getSignature()); copy.setRegistrationDate(user.getRegistrationDate()); copy.setEnabled(user.isEnabled()); copy.setAutosubscribe(user.isAutosubscribe()); copy.setMentioningNotificationsEnabled(user.isMentioningNotificationsEnabled()); copy.setSendPmNotification(user.isSendPmNotification()); copy.setAvatarLastModificationTime(user.getAvatarLastModificationTime()); copy.setAllForumMarkedAsReadTime(user.getAllForumMarkedAsReadTime()); copy.setUuid(user.getUuid()); 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 copyUserShouldCopyCorrectlyIfOnlyRequiredFieldsFilled() { JCUser user = new JCUser("username", "email@mail.com", "pass"); JCUser copy = JCUser.copyUser(user); assertNotSame(copy, user); assertReflectionEquals(user, copy); }