@Test void convertShouldReturnCorrespondingDeletedMessageWhenNoSender() throws Exception { MessageBuilder builder = new MessageBuilder() .header(FROM_FIELD, "alice@james.com") .header(TO_FIELD, RECIPIENT1.asString()) .header(CC_FIELD, RECIPIENT2.asString()) .header(SUBJECT_FIELD, SUBJECT) .header(DATE_FIELD, "Thu, 30 Oct 2014 14:12:00 +0000 (GMT)"); DeletedMessage deletedMessage = deletedMessageConverter.convert(DELETED_MESSAGE_MAILBOX_CONTEXT, buildMessage(builder, NO_ATTACHMENT), DELETION_DATE); assertThat(deletedMessage.getSender()) .isEqualTo(MaybeSender.nullSender()); }
DeletedMessage convert(DeletedMessageVaultHook.DeletedMessageMailboxContext deletedMessageMailboxContext, org.apache.james.mailbox.store.mail.model.Message message, ZonedDateTime deletionDate) throws IOException { Preconditions.checkNotNull(deletedMessageMailboxContext); Preconditions.checkNotNull(message); Optional<Message> mimeMessage = parseMessage(message); return DeletedMessage.builder() .messageId(deletedMessageMailboxContext.getMessageId()) .originMailboxes(deletedMessageMailboxContext.getOwnerMailboxes()) .user(retrieveOwner(deletedMessageMailboxContext)) .deliveryDate(retrieveDeliveryDate(mimeMessage, message)) .deletionDate(deletionDate) .sender(retrieveSender(mimeMessage)) .recipients(retrieveRecipients(mimeMessage)) .hasAttachment(!message.getAttachments().isEmpty()) .size(message.getFullContentOctets()) .subject(mimeMessage.map(Message::getSubject)) .build(); }
DeletedMessageConverter { DeletedMessage convert(DeletedMessageVaultHook.DeletedMessageMailboxContext deletedMessageMailboxContext, org.apache.james.mailbox.store.mail.model.Message message, ZonedDateTime deletionDate) throws IOException { Preconditions.checkNotNull(deletedMessageMailboxContext); Preconditions.checkNotNull(message); Optional<Message> mimeMessage = parseMessage(message); return DeletedMessage.builder() .messageId(deletedMessageMailboxContext.getMessageId()) .originMailboxes(deletedMessageMailboxContext.getOwnerMailboxes()) .user(retrieveOwner(deletedMessageMailboxContext)) .deliveryDate(retrieveDeliveryDate(mimeMessage, message)) .deletionDate(deletionDate) .sender(retrieveSender(mimeMessage)) .recipients(retrieveRecipients(mimeMessage)) .hasAttachment(!message.getAttachments().isEmpty()) .size(message.getFullContentOctets()) .subject(mimeMessage.map(Message::getSubject)) .build(); } }
DeletedMessageConverter { DeletedMessage convert(DeletedMessageVaultHook.DeletedMessageMailboxContext deletedMessageMailboxContext, org.apache.james.mailbox.store.mail.model.Message message, ZonedDateTime deletionDate) throws IOException { Preconditions.checkNotNull(deletedMessageMailboxContext); Preconditions.checkNotNull(message); Optional<Message> mimeMessage = parseMessage(message); return DeletedMessage.builder() .messageId(deletedMessageMailboxContext.getMessageId()) .originMailboxes(deletedMessageMailboxContext.getOwnerMailboxes()) .user(retrieveOwner(deletedMessageMailboxContext)) .deliveryDate(retrieveDeliveryDate(mimeMessage, message)) .deletionDate(deletionDate) .sender(retrieveSender(mimeMessage)) .recipients(retrieveRecipients(mimeMessage)) .hasAttachment(!message.getAttachments().isEmpty()) .size(message.getFullContentOctets()) .subject(mimeMessage.map(Message::getSubject)) .build(); }  }
DeletedMessageConverter { DeletedMessage convert(DeletedMessageVaultHook.DeletedMessageMailboxContext deletedMessageMailboxContext, org.apache.james.mailbox.store.mail.model.Message message, ZonedDateTime deletionDate) throws IOException { Preconditions.checkNotNull(deletedMessageMailboxContext); Preconditions.checkNotNull(message); Optional<Message> mimeMessage = parseMessage(message); return DeletedMessage.builder() .messageId(deletedMessageMailboxContext.getMessageId()) .originMailboxes(deletedMessageMailboxContext.getOwnerMailboxes()) .user(retrieveOwner(deletedMessageMailboxContext)) .deliveryDate(retrieveDeliveryDate(mimeMessage, message)) .deletionDate(deletionDate) .sender(retrieveSender(mimeMessage)) .recipients(retrieveRecipients(mimeMessage)) .hasAttachment(!message.getAttachments().isEmpty()) .size(message.getFullContentOctets()) .subject(mimeMessage.map(Message::getSubject)) .build(); }   }
DeletedMessageConverter { DeletedMessage convert(DeletedMessageVaultHook.DeletedMessageMailboxContext deletedMessageMailboxContext, org.apache.james.mailbox.store.mail.model.Message message, ZonedDateTime deletionDate) throws IOException { Preconditions.checkNotNull(deletedMessageMailboxContext); Preconditions.checkNotNull(message); Optional<Message> mimeMessage = parseMessage(message); return DeletedMessage.builder() .messageId(deletedMessageMailboxContext.getMessageId()) .originMailboxes(deletedMessageMailboxContext.getOwnerMailboxes()) .user(retrieveOwner(deletedMessageMailboxContext)) .deliveryDate(retrieveDeliveryDate(mimeMessage, message)) .deletionDate(deletionDate) .sender(retrieveSender(mimeMessage)) .recipients(retrieveRecipients(mimeMessage)) .hasAttachment(!message.getAttachments().isEmpty()) .size(message.getFullContentOctets()) .subject(mimeMessage.map(Message::getSubject)) .build(); }    }