### Question:
JCUser extends User { @VisibleForTesting static UserContact copyUserContact(UserContact contact, JCUser owner) { if (contact == null) { throw new IllegalArgumentException("User contact should not be null"); } UserContact copy = new UserContact(contact.getValue(), contact.getType()); copy.setOwner(owner); copy.setId(contact.getId()); copy.setUuid(contact.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 copyUserContactShouldCopyCorrectlyIfOnlyRequiredFieldsFilled() { UserContactType contactType = new UserContactType(); contactType.setDisplayPattern("*"); UserContact contact = new UserContact("valuse", contactType); JCUser owner = new JCUser("username", "email@mail.com", "pass"); UserContact copy = JCUser.copyUserContact(contact, owner); assertNotSame(copy, contact); assertUserContactEqualsIgnoreOwner(contact, copy); assertSame(copy.getOwner(), owner); }
@Test public void copyUserContactShouldCopyCorrectlyIfAllFieldsFilled() { UserContactType contactType = new UserContactType(); contactType.setDisplayPattern("*"); UserContact contact = new UserContact("valuse", contactType); JCUser oldOwner = new JCUser("username", "email@mail.com", "pass"); JCUser newOwner = new JCUser("username", "email@mail.com", "pass"); contact.setOwner(oldOwner); contact.setId(1); contact.setUuid("uuid"); UserContact copy = JCUser.copyUserContact(contact, newOwner); assertNotSame(copy, contact); assertUserContactEqualsIgnoreOwner(contact, copy); assertSame(copy.getOwner(), newOwner); }