@Test public void testSendEmailNotification() { expect(mockedCaseFileDao.find(requestId)).andReturn(mockedRequest); expect(mockedRequest.getOriginator()).andReturn(mockedPersonAssociation); expect(mockedPersonAssociation.getPerson()).andReturn(mockedPerson); expect(mockedPerson.getContactMethods()).andReturn(mockedContactMethods); expect(mockedContactMethod.getType()).andReturn(emailType); expect(mockedContactMethod.getValue()).andReturn(emailAddress); expect(mockedRequest.getRequestType()).andReturn(requestType).anyTimes(); expect(mockedRequest.getCaseNumber()).andReturn(caseNumber).anyTimes(); expect(mockedRequest.getObjectType()).andReturn(objectType).anyTimes(); expect(mockedRequest.getId()).andReturn(requestId).anyTimes(); Capture<Notification> captureReleaseNotifier = Capture.newInstance(); expect(mockNotificationDao.save(capture(captureReleaseNotifier))).andReturn(new Notification()); replayAll(); responseFolderNotifyService.sendEmailNotification(requestId); verifyAll(); assertEquals(String.format("%s %s", FOIAConstants.EMAIL_RELEASE_SUBJECT, caseNumber), captureReleaseNotifier.getValue().getTitle()); assertEquals(emailAddress, captureReleaseNotifier.getValue().getEmailAddresses()); }
public void sendEmailNotification(Long requestId) { FOIARequest request = (FOIARequest) caseFileDao.find(requestId); String emailAddress = extractRequestorEmailAddress(request.getOriginator().getPerson()); if (emailAddress != null) { Notification responseFolderNotifier = new Notification(); responseFolderNotifier.setEmailAddresses(emailAddress); responseFolderNotifier.setTitle(String.format("%s %s", EMAIL_RELEASE_SUBJECT, request.getCaseNumber())); responseFolderNotifier.setTemplateModelName("requestReleased"); responseFolderNotifier.setParentType(request.getObjectType()); responseFolderNotifier.setParentId(request.getId()); responseFolderNotifier.setAttachFiles(false); notificationDao.save(responseFolderNotifier); } }
ResponseFolderNotifyService { public void sendEmailNotification(Long requestId) { FOIARequest request = (FOIARequest) caseFileDao.find(requestId); String emailAddress = extractRequestorEmailAddress(request.getOriginator().getPerson()); if (emailAddress != null) { Notification responseFolderNotifier = new Notification(); responseFolderNotifier.setEmailAddresses(emailAddress); responseFolderNotifier.setTitle(String.format("%s %s", EMAIL_RELEASE_SUBJECT, request.getCaseNumber())); responseFolderNotifier.setTemplateModelName("requestReleased"); responseFolderNotifier.setParentType(request.getObjectType()); responseFolderNotifier.setParentId(request.getId()); responseFolderNotifier.setAttachFiles(false); notificationDao.save(responseFolderNotifier); } } }
ResponseFolderNotifyService { public void sendEmailNotification(Long requestId) { FOIARequest request = (FOIARequest) caseFileDao.find(requestId); String emailAddress = extractRequestorEmailAddress(request.getOriginator().getPerson()); if (emailAddress != null) { Notification responseFolderNotifier = new Notification(); responseFolderNotifier.setEmailAddresses(emailAddress); responseFolderNotifier.setTitle(String.format("%s %s", EMAIL_RELEASE_SUBJECT, request.getCaseNumber())); responseFolderNotifier.setTemplateModelName("requestReleased"); responseFolderNotifier.setParentType(request.getObjectType()); responseFolderNotifier.setParentId(request.getId()); responseFolderNotifier.setAttachFiles(false); notificationDao.save(responseFolderNotifier); } }  }
ResponseFolderNotifyService { public void sendEmailNotification(Long requestId) { FOIARequest request = (FOIARequest) caseFileDao.find(requestId); String emailAddress = extractRequestorEmailAddress(request.getOriginator().getPerson()); if (emailAddress != null) { Notification responseFolderNotifier = new Notification(); responseFolderNotifier.setEmailAddresses(emailAddress); responseFolderNotifier.setTitle(String.format("%s %s", EMAIL_RELEASE_SUBJECT, request.getCaseNumber())); responseFolderNotifier.setTemplateModelName("requestReleased"); responseFolderNotifier.setParentType(request.getObjectType()); responseFolderNotifier.setParentId(request.getId()); responseFolderNotifier.setAttachFiles(false); notificationDao.save(responseFolderNotifier); } }  AcmApplication getAcmAppConfiguration(); void setAcmAppConfiguration(AcmApplication acmAppConfiguration); void sendEmailNotification(Long requestId); void sendEmailResponseCompressNotification(Long requestId); FolderCompressor getCompressor(); void setCompressor(FolderCompressor compressor); ResponseFolderService getResponseFolderService(); void setResponseFolderService(ResponseFolderService responseFolderService); NotificationSender getNotificationSender(); void setNotificationSender(NotificationSender notificationSender); UserDao getUserDao(); void setUserDao(UserDao userDao); CaseFileDao getCaseFileDao(); void setCaseFileDao(CaseFileDao caseFileDao); NotificationDao getNotificationDao(); void setNotificationDao(NotificationDao notificationDao); }
ResponseFolderNotifyService { public void sendEmailNotification(Long requestId) { FOIARequest request = (FOIARequest) caseFileDao.find(requestId); String emailAddress = extractRequestorEmailAddress(request.getOriginator().getPerson()); if (emailAddress != null) { Notification responseFolderNotifier = new Notification(); responseFolderNotifier.setEmailAddresses(emailAddress); responseFolderNotifier.setTitle(String.format("%s %s", EMAIL_RELEASE_SUBJECT, request.getCaseNumber())); responseFolderNotifier.setTemplateModelName("requestReleased"); responseFolderNotifier.setParentType(request.getObjectType()); responseFolderNotifier.setParentId(request.getId()); responseFolderNotifier.setAttachFiles(false); notificationDao.save(responseFolderNotifier); } }  AcmApplication getAcmAppConfiguration(); void setAcmAppConfiguration(AcmApplication acmAppConfiguration); void sendEmailNotification(Long requestId); void sendEmailResponseCompressNotification(Long requestId); FolderCompressor getCompressor(); void setCompressor(FolderCompressor compressor); ResponseFolderService getResponseFolderService(); void setResponseFolderService(ResponseFolderService responseFolderService); NotificationSender getNotificationSender(); void setNotificationSender(NotificationSender notificationSender); UserDao getUserDao(); void setUserDao(UserDao userDao); CaseFileDao getCaseFileDao(); void setCaseFileDao(CaseFileDao caseFileDao); NotificationDao getNotificationDao(); void setNotificationDao(NotificationDao notificationDao);  }