@Test public void testAnswerRecievedFragaSvarSendsMail() { when(integreradeEnheterRegistry.isEnhetIntegrerad(ENHET_ID, INTYG_TYP_FK)).thenReturn(false); notificationService.sendNotificationForAnswerRecieved(createFragaSvar()); ArgumentCaptor<MailNotification> mailNotificationCaptor = ArgumentCaptor.forClass(MailNotification.class); verify(mailNotificationService).sendMailForIncomingAnswer(mailNotificationCaptor.capture()); assertEquals(ENHET_ID, mailNotificationCaptor.getValue().getCareUnitId()); assertEquals(FRAGASVAR_ID.toString(), mailNotificationCaptor.getValue().getQaId()); assertEquals(INTYG_ID, mailNotificationCaptor.getValue().getCertificateId()); assertEquals(INTYG_TYP_FK, mailNotificationCaptor.getValue().getCertificateType()); assertEquals(ENHET_NAMN, mailNotificationCaptor.getValue().getCareUnitName()); assertEquals(SIGNED_BY_HSA_ID, mailNotificationCaptor.getValue().getSignedByHsaId()); verifyNoInteractions(mockNotificationMessageFactory); verifyNoInteractions(template); verifyNoInteractions(mockMonitoringLogService); }
@Override public void sendNotificationForAnswerRecieved(FragaSvar fragaSvar) { if (integreradeEnheterRegistry.isEnhetIntegrerad(fragaSvar.getVardperson().getEnhetsId(), Fk7263EntryPoint.MODULE_ID)) { sendNotificationForQAs(fragaSvar.getIntygsReferens().getIntygsId(), NotificationEvent.NEW_ANSWER_FROM_RECIPIENT); } else { sendNotificationForIncomingAnswerByMail(new MailNotification(fragaSvar.getInternReferens().toString(), fragaSvar.getIntygsReferens().getIntygsId(), Fk7263EntryPoint.MODULE_ID, fragaSvar.getVardperson().getEnhetsId(), fragaSvar.getVardperson().getEnhetsnamn(), fragaSvar.getVardperson().getHsaId())); } }
NotificationServiceImpl implements NotificationService { @Override public void sendNotificationForAnswerRecieved(FragaSvar fragaSvar) { if (integreradeEnheterRegistry.isEnhetIntegrerad(fragaSvar.getVardperson().getEnhetsId(), Fk7263EntryPoint.MODULE_ID)) { sendNotificationForQAs(fragaSvar.getIntygsReferens().getIntygsId(), NotificationEvent.NEW_ANSWER_FROM_RECIPIENT); } else { sendNotificationForIncomingAnswerByMail(new MailNotification(fragaSvar.getInternReferens().toString(), fragaSvar.getIntygsReferens().getIntygsId(), Fk7263EntryPoint.MODULE_ID, fragaSvar.getVardperson().getEnhetsId(), fragaSvar.getVardperson().getEnhetsnamn(), fragaSvar.getVardperson().getHsaId())); } } }
NotificationServiceImpl implements NotificationService { @Override public void sendNotificationForAnswerRecieved(FragaSvar fragaSvar) { if (integreradeEnheterRegistry.isEnhetIntegrerad(fragaSvar.getVardperson().getEnhetsId(), Fk7263EntryPoint.MODULE_ID)) { sendNotificationForQAs(fragaSvar.getIntygsReferens().getIntygsId(), NotificationEvent.NEW_ANSWER_FROM_RECIPIENT); } else { sendNotificationForIncomingAnswerByMail(new MailNotification(fragaSvar.getInternReferens().toString(), fragaSvar.getIntygsReferens().getIntygsId(), Fk7263EntryPoint.MODULE_ID, fragaSvar.getVardperson().getEnhetsId(), fragaSvar.getVardperson().getEnhetsnamn(), fragaSvar.getVardperson().getHsaId())); } }  }
NotificationServiceImpl implements NotificationService { @Override public void sendNotificationForAnswerRecieved(FragaSvar fragaSvar) { if (integreradeEnheterRegistry.isEnhetIntegrerad(fragaSvar.getVardperson().getEnhetsId(), Fk7263EntryPoint.MODULE_ID)) { sendNotificationForQAs(fragaSvar.getIntygsReferens().getIntygsId(), NotificationEvent.NEW_ANSWER_FROM_RECIPIENT); } else { sendNotificationForIncomingAnswerByMail(new MailNotification(fragaSvar.getInternReferens().toString(), fragaSvar.getIntygsReferens().getIntygsId(), Fk7263EntryPoint.MODULE_ID, fragaSvar.getVardperson().getEnhetsId(), fragaSvar.getVardperson().getEnhetsnamn(), fragaSvar.getVardperson().getHsaId())); } }  @PostConstruct void checkJmsTemplate(); @Override void sendNotificationForDraftCreated(Utkast utkast); @Override void sendNotificationForDraftSigned(Utkast utkast); @Override void sendNotificationForDraftChanged(Utkast utkast); @Override void sendNotificationForDraftDeleted(Utkast utkast); @Override void sendNotificationForDraftRevoked(Utkast utkast); @Override void sendNotificationForDraftReadyToSign(Utkast utkast); @Override void sendNotificationForIntygSent(String intygsId); @Override void sendNotificationForIntygRevoked(String intygsId); @Override void sendNotificationForQuestionReceived(FragaSvar fragaSvar); @Override void sendNotificationForAnswerRecieved(FragaSvar fragaSvar); @Override void sendNotificationForQuestionReceived(Arende arende); @Override void sendNotificationForAnswerRecieved(Arende arende); @Override List<Handelse> getNotifications(String intygsId); @Override void sendNotificationForQAs(String intygsId, NotificationEvent event); @Override void forwardInternalNotification(final String intygsId, final String intygstyp, final Utlatande utlatande,
        final HandelsekodEnum handelse); @Override List<Handelse> findNotifications(IntygWithNotificationsRequest request); }
NotificationServiceImpl implements NotificationService { @Override public void sendNotificationForAnswerRecieved(FragaSvar fragaSvar) { if (integreradeEnheterRegistry.isEnhetIntegrerad(fragaSvar.getVardperson().getEnhetsId(), Fk7263EntryPoint.MODULE_ID)) { sendNotificationForQAs(fragaSvar.getIntygsReferens().getIntygsId(), NotificationEvent.NEW_ANSWER_FROM_RECIPIENT); } else { sendNotificationForIncomingAnswerByMail(new MailNotification(fragaSvar.getInternReferens().toString(), fragaSvar.getIntygsReferens().getIntygsId(), Fk7263EntryPoint.MODULE_ID, fragaSvar.getVardperson().getEnhetsId(), fragaSvar.getVardperson().getEnhetsnamn(), fragaSvar.getVardperson().getHsaId())); } }  @PostConstruct void checkJmsTemplate(); @Override void sendNotificationForDraftCreated(Utkast utkast); @Override void sendNotificationForDraftSigned(Utkast utkast); @Override void sendNotificationForDraftChanged(Utkast utkast); @Override void sendNotificationForDraftDeleted(Utkast utkast); @Override void sendNotificationForDraftRevoked(Utkast utkast); @Override void sendNotificationForDraftReadyToSign(Utkast utkast); @Override void sendNotificationForIntygSent(String intygsId); @Override void sendNotificationForIntygRevoked(String intygsId); @Override void sendNotificationForQuestionReceived(FragaSvar fragaSvar); @Override void sendNotificationForAnswerRecieved(FragaSvar fragaSvar); @Override void sendNotificationForQuestionReceived(Arende arende); @Override void sendNotificationForAnswerRecieved(Arende arende); @Override List<Handelse> getNotifications(String intygsId); @Override void sendNotificationForQAs(String intygsId, NotificationEvent event); @Override void forwardInternalNotification(final String intygsId, final String intygstyp, final Utlatande utlatande,
        final HandelsekodEnum handelse); @Override List<Handelse> findNotifications(IntygWithNotificationsRequest request);  }