@Test public void setEmailCheckedTrueNormalUser() throws XWikiException { XWikiUser user = new XWikiUser(userReference); user.setEmailChecked(true, mockitoOldcore.getXWikiContext()); verify(userDocument, times(1)).setIntValue(userClassReference, XWikiUser.EMAIL_CHECKED_PROPERTY, 1); verify(mockitoOldcore.getSpyXWiki(), times(1)) .saveDocument(same(userDocument), any(String.class), same(mockitoOldcore.getXWikiContext())); }
@Unstable public void setEmailChecked(boolean checked, XWikiContext context) { if (!isGuest() && !isSuperAdmin()) { int checkedFlag = (checked) ? 1 : 0; try { XWikiDocument userdoc = getUserDocument(context); userdoc.setIntValue(getUserClassReference(userdoc.getDocumentReference().getWikiReference()), EMAIL_CHECKED_PROPERTY, checkedFlag); context.getWiki().saveDocument(userdoc, localizePlainOrKey( "core.users." + (checked ? "email_checked" : "email_unchecked") + ".saveComment"), context); } catch (XWikiException e) { this.logger.error("Error while setting email_checked status of user [{}]", getUser(), e); } } }
XWikiUser { @Unstable public void setEmailChecked(boolean checked, XWikiContext context) { if (!isGuest() && !isSuperAdmin()) { int checkedFlag = (checked) ? 1 : 0; try { XWikiDocument userdoc = getUserDocument(context); userdoc.setIntValue(getUserClassReference(userdoc.getDocumentReference().getWikiReference()), EMAIL_CHECKED_PROPERTY, checkedFlag); context.getWiki().saveDocument(userdoc, localizePlainOrKey( "core.users." + (checked ? "email_checked" : "email_unchecked") + ".saveComment"), context); } catch (XWikiException e) { this.logger.error("Error while setting email_checked status of user [{}]", getUser(), e); } } } }
XWikiUser { @Unstable public void setEmailChecked(boolean checked, XWikiContext context) { if (!isGuest() && !isSuperAdmin()) { int checkedFlag = (checked) ? 1 : 0; try { XWikiDocument userdoc = getUserDocument(context); userdoc.setIntValue(getUserClassReference(userdoc.getDocumentReference().getWikiReference()), EMAIL_CHECKED_PROPERTY, checkedFlag); context.getWiki().saveDocument(userdoc, localizePlainOrKey( "core.users." + (checked ? "email_checked" : "email_unchecked") + ".saveComment"), context); } catch (XWikiException e) { this.logger.error("Error while setting email_checked status of user [{}]", getUser(), e); } } } @Unstable  XWikiUser(DocumentReference userReference); @Unstable  XWikiUser(DocumentReference userReference, boolean main); @Deprecated  XWikiUser(String user); @Deprecated  XWikiUser(String user, boolean main); }
XWikiUser { @Unstable public void setEmailChecked(boolean checked, XWikiContext context) { if (!isGuest() && !isSuperAdmin()) { int checkedFlag = (checked) ? 1 : 0; try { XWikiDocument userdoc = getUserDocument(context); userdoc.setIntValue(getUserClassReference(userdoc.getDocumentReference().getWikiReference()), EMAIL_CHECKED_PROPERTY, checkedFlag); context.getWiki().saveDocument(userdoc, localizePlainOrKey( "core.users." + (checked ? "email_checked" : "email_unchecked") + ".saveComment"), context); } catch (XWikiException e) { this.logger.error("Error while setting email_checked status of user [{}]", getUser(), e); } } } @Unstable  XWikiUser(DocumentReference userReference); @Unstable  XWikiUser(DocumentReference userReference, boolean main); @Deprecated  XWikiUser(String user); @Deprecated  XWikiUser(String user, boolean main); @Deprecated String getUser(); String getFullName(); DocumentReference getUserReference(); @Unstable boolean isEmailChecked(XWikiContext context); @Unstable void setEmailChecked(boolean checked, XWikiContext context); @Unstable boolean isDisabled(XWikiContext context); @Unstable void setDisabled(boolean disable, XWikiContext context); @Unstable boolean exists(XWikiContext context); void setUser(String user); boolean isUserInGroup(String groupName, XWikiContext context); boolean isMain(); void setMain(boolean main); @Override String toString(); @Override boolean equals(Object obj); }
XWikiUser { @Unstable public void setEmailChecked(boolean checked, XWikiContext context) { if (!isGuest() && !isSuperAdmin()) { int checkedFlag = (checked) ? 1 : 0; try { XWikiDocument userdoc = getUserDocument(context); userdoc.setIntValue(getUserClassReference(userdoc.getDocumentReference().getWikiReference()), EMAIL_CHECKED_PROPERTY, checkedFlag); context.getWiki().saveDocument(userdoc, localizePlainOrKey( "core.users." + (checked ? "email_checked" : "email_unchecked") + ".saveComment"), context); } catch (XWikiException e) { this.logger.error("Error while setting email_checked status of user [{}]", getUser(), e); } } } @Unstable  XWikiUser(DocumentReference userReference); @Unstable  XWikiUser(DocumentReference userReference, boolean main); @Deprecated  XWikiUser(String user); @Deprecated  XWikiUser(String user, boolean main); @Deprecated String getUser(); String getFullName(); DocumentReference getUserReference(); @Unstable boolean isEmailChecked(XWikiContext context); @Unstable void setEmailChecked(boolean checked, XWikiContext context); @Unstable boolean isDisabled(XWikiContext context); @Unstable void setDisabled(boolean disable, XWikiContext context); @Unstable boolean exists(XWikiContext context); void setUser(String user); boolean isUserInGroup(String groupName, XWikiContext context); boolean isMain(); void setMain(boolean main); @Override String toString(); @Override boolean equals(Object obj); @Unstable
    static final String ACTIVE_PROPERTY; @Unstable
    static final String EMAIL_CHECKED_PROPERTY; }