@Test public void shouldInsertEmailMessageAndRelationWhenHasAttachments() throws Exception { EmailMessage message = generateEmailMessage(); message.addEmailAttachment(generateEmailAttachment()); message.addEmailAttachment(generateEmailAttachment()); repository.queueEmailMessage(message); verify(mapper).insertEmailMessage(message); verify(mapper, times(2)).insertEmailAttachmentsRelation(anyLong(), anyLong()); }
public EmailMessage queueEmailMessage(EmailMessage message) { mapper.insertEmailMessage(message); for (EmailAttachment attachment : message.getEmailAttachments()) { mapper.insertEmailAttachmentsRelation(message.getId(), attachment.getId()); } return message; }
EmailNotificationRepository { public EmailMessage queueEmailMessage(EmailMessage message) { mapper.insertEmailMessage(message); for (EmailAttachment attachment : message.getEmailAttachments()) { mapper.insertEmailAttachmentsRelation(message.getId(), attachment.getId()); } return message; } }
EmailNotificationRepository { public EmailMessage queueEmailMessage(EmailMessage message) { mapper.insertEmailMessage(message); for (EmailAttachment attachment : message.getEmailAttachments()) { mapper.insertEmailAttachmentsRelation(message.getId(), attachment.getId()); } return message; }  }
EmailNotificationRepository { public EmailMessage queueEmailMessage(EmailMessage message) { mapper.insertEmailMessage(message); for (EmailAttachment attachment : message.getEmailAttachments()) { mapper.insertEmailAttachmentsRelation(message.getId(), attachment.getId()); } return message; }  @Deprecated void queueMessage(SimpleMailMessage message); @Deprecated void queueMessage(String to, String message, String subject, Boolean isHtml); EmailMessage queueEmailMessage(EmailMessage message); EmailAttachment insertEmailAttachment(EmailAttachment attachment); List<EmailAttachment> getEmailAttachmentsByEmailId(Long id); }
EmailNotificationRepository { public EmailMessage queueEmailMessage(EmailMessage message) { mapper.insertEmailMessage(message); for (EmailAttachment attachment : message.getEmailAttachments()) { mapper.insertEmailAttachmentsRelation(message.getId(), attachment.getId()); } return message; }  @Deprecated void queueMessage(SimpleMailMessage message); @Deprecated void queueMessage(String to, String message, String subject, Boolean isHtml); EmailMessage queueEmailMessage(EmailMessage message); EmailAttachment insertEmailAttachment(EmailAttachment attachment); List<EmailAttachment> getEmailAttachmentsByEmailId(Long id);  }