### Question:
MailService { public void sendUserMentionedNotification(JCUser recipient, long postId) { String urlSuffix = "/posts/" + postId; String url = this.getDeploymentRootUrl() + urlSuffix; Locale locale = recipient.getLanguage().getLocale(); Map<String, Object> model = new HashMap<>(); model.put(NAME, recipient.getUsername()); model.put(LINK, url); model.put(LINK_LABEL, getDeploymentRootUrlWithoutPort() + urlSuffix); model.put(RECIPIENT_LOCALE, locale); try { this.sendEmail(recipient.getEmail(), messageSource.getMessage("userMentioning.subject", new Object[]{}, locale), model, "userMentioning.vm"); } catch (MailingFailedException e) { LOGGER.error("Failed to sent activation mail for user: " + recipient.getUsername()); } } MailService(JavaMailSender sender,
                       String from,
                       VelocityEngine engine,
                       MessageSource source,
                       JCommuneProperty notificationsEnabledProperty,
                       EscapeTool escapeTool,
                       EntityToDtoConverter converter); void sendPasswordRecoveryMail(JCUser user, String newPassword); void sendUpdatesOnSubscription(JCUser recipient, SubscriptionAwareEntity entity); void sendReceivedPrivateMessageNotification(JCUser recipient, PrivateMessage pm); void sendAccountActivationMail(JCUser recipient); void sendTopicMovedMail(
            JCUser recipient, Topic topic, String curUser, Class<T> subsсriptionTargetClass) ; void sendUserMentionedNotification(JCUser recipient, long postId); void sendRemovingTopicMail(JCUser recipient, Topic topic, String curUser); static final String REMOVE_TOPIC_SUBJECT_TEMPLATE; static final String REMOVE_CODE_REVIEW_SUBJECT_TEMPLATE; static final String REMOVE_TOPIC_MESSAGE_BODY_TEMPLATE; static final String REMOVE_CODE_REVIEW_MESSAGE_BODY_TEMPLATE; }### Answer:
@Test public void sendUserMentionedNotificationShouldSentIt() throws Exception { enableEmailNotifications(); long postId = 25l; service.sendUserMentionedNotification(user, postId); this.checkMailCredentials(); assertTrue(this.getMimeMailBody().contains(USERNAME)); assertTrue(this.getMimeMailBody().contains("http: }
@Test public void sendUserMentionedNotificationShouldNotSentWhenForumNotificationsAreDisabled() throws Exception { disableEmailNotifications(); long postId = 25l; service.sendUserMentionedNotification(user, postId); verify(sender, never()).send(any(MimeMessage.class)); }