@Test public void testSendMailForIncomingQuestionHsaIsCalledIfNotPrivatePractitioner() { MailNotification mailNotification = mailNotification("intygsId", "ThisIsNotPp" + MailNotificationServiceImpl.PRIVATE_PRACTITIONER_HSAID_PREFIX + "1234"); try { mailNotificationService.sendMailForIncomingQuestion(mailNotification); } catch (IllegalArgumentException e) { } verify(hsaOrganizationUnitService, times(1)).getVardenhet(anyString()); }
@Override @Async("threadPoolTaskExecutor") public void sendMailForIncomingQuestion(MailNotification mailNotification) { String type = "question"; MailNotificationEnhet recipient = getUnit(mailNotification); if (recipient == null) { logError(type, mailNotification, null); } else { try { String reason = "incoming question '" + mailNotification.getQaId() + "'"; sendNotificationMailToEnhet(type, mailNotification, INCOMING_QUESTION_SUBJECT, mailBodyForFraga(recipient, mailNotification), recipient, reason); } catch (MailSendException | MessagingException e) { logError(type, mailNotification, e); } } }
MailNotificationServiceImpl implements MailNotificationService { @Override @Async("threadPoolTaskExecutor") public void sendMailForIncomingQuestion(MailNotification mailNotification) { String type = "question"; MailNotificationEnhet recipient = getUnit(mailNotification); if (recipient == null) { logError(type, mailNotification, null); } else { try { String reason = "incoming question '" + mailNotification.getQaId() + "'"; sendNotificationMailToEnhet(type, mailNotification, INCOMING_QUESTION_SUBJECT, mailBodyForFraga(recipient, mailNotification), recipient, reason); } catch (MailSendException | MessagingException e) { logError(type, mailNotification, e); } } } }
MailNotificationServiceImpl implements MailNotificationService { @Override @Async("threadPoolTaskExecutor") public void sendMailForIncomingQuestion(MailNotification mailNotification) { String type = "question"; MailNotificationEnhet recipient = getUnit(mailNotification); if (recipient == null) { logError(type, mailNotification, null); } else { try { String reason = "incoming question '" + mailNotification.getQaId() + "'"; sendNotificationMailToEnhet(type, mailNotification, INCOMING_QUESTION_SUBJECT, mailBodyForFraga(recipient, mailNotification), recipient, reason); } catch (MailSendException | MessagingException e) { logError(type, mailNotification, e); } } }  }
MailNotificationServiceImpl implements MailNotificationService { @Override @Async("threadPoolTaskExecutor") public void sendMailForIncomingQuestion(MailNotification mailNotification) { String type = "question"; MailNotificationEnhet recipient = getUnit(mailNotification); if (recipient == null) { logError(type, mailNotification, null); } else { try { String reason = "incoming question '" + mailNotification.getQaId() + "'"; sendNotificationMailToEnhet(type, mailNotification, INCOMING_QUESTION_SUBJECT, mailBodyForFraga(recipient, mailNotification), recipient, reason); } catch (MailSendException | MessagingException e) { logError(type, mailNotification, e); } } }  @Override @Async("threadPoolTaskExecutor") void sendMailForIncomingQuestion(MailNotification mailNotification); @Override @Async("threadPoolTaskExecutor") void sendMailForIncomingAnswer(MailNotification mailNotification); void setAdminMailAddress(String adminMailAddress); void setWebCertHostUrl(String webCertHostUrl); @Override @Transactional(readOnly = true) String intygsUrl(MailNotification mailNotification); }
MailNotificationServiceImpl implements MailNotificationService { @Override @Async("threadPoolTaskExecutor") public void sendMailForIncomingQuestion(MailNotification mailNotification) { String type = "question"; MailNotificationEnhet recipient = getUnit(mailNotification); if (recipient == null) { logError(type, mailNotification, null); } else { try { String reason = "incoming question '" + mailNotification.getQaId() + "'"; sendNotificationMailToEnhet(type, mailNotification, INCOMING_QUESTION_SUBJECT, mailBodyForFraga(recipient, mailNotification), recipient, reason); } catch (MailSendException | MessagingException e) { logError(type, mailNotification, e); } } }  @Override @Async("threadPoolTaskExecutor") void sendMailForIncomingQuestion(MailNotification mailNotification); @Override @Async("threadPoolTaskExecutor") void sendMailForIncomingAnswer(MailNotification mailNotification); void setAdminMailAddress(String adminMailAddress); void setWebCertHostUrl(String webCertHostUrl); @Override @Transactional(readOnly = true) String intygsUrl(MailNotification mailNotification);  }