SimpleMailboxMessage extends DelegatingMailboxMessage { public static Builder builder() { return new Builder(); } SimpleMailboxMessage(MessageId messageId, Date internalDate, long size, int bodyStartOctet,
            SharedInputStream content, Flags flags,
            PropertyBuilder propertyBuilder, MailboxId mailboxId, List<MessageAttachmentMetadata> attachments);  SimpleMailboxMessage(MessageId messageId, Date internalDate, long size, int bodyStartOctet,
                                SharedInputStream content, Flags flags,
                                PropertyBuilder propertyBuilder, MailboxId mailboxId); static Builder builder(); static Builder from(MailboxMessage original); static SimpleMailboxMessage copy(MailboxId mailboxId, MailboxMessage original); static Builder fromWithoutAttachments(MailboxMessage original); static SimpleMailboxMessage copyWithoutAttachments(MailboxId mailboxId, MailboxMessage original); @Override ComposedMessageIdWithMetaData getComposedMessageIdWithMetaData(); @Override MailboxId getMailboxId(); @Override MessageUid getUid(); @Override boolean isAnswered(); @Override boolean isDeleted(); @Override boolean isDraft(); @Override boolean isFlagged(); @Override boolean isRecent(); @Override boolean isSeen(); @Override ModSeq getModSeq(); @Override void setModSeq(ModSeq modSeq); @Override void setUid(MessageUid uid); @Override synchronized void setFlags(Flags flags); @Override int hashCode(); @Override boolean equals(Object obj); String toString();  }
@Test void sizeShouldThrowWhenNegative() { assertThatThrownBy(() -> SimpleMailboxMessage.builder() .size(-1)) .isInstanceOf(IllegalArgumentException.class); }
@Test void bodyStartOctetShouldThrowWhenNegative() { assertThatThrownBy(() -> SimpleMailboxMessage.builder() .bodyStartOctet(-1)) .isInstanceOf(IllegalArgumentException.class); }
@Test void buildShouldWorkWithMinimalContent() { Date internalDate = new Date(); SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .content(CONTENT_STREAM) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build(); }
@Test void buildShouldThrowOnMissingMessageId() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .mailboxId(TEST_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .content(CONTENT_STREAM) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingMailboxId() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .content(CONTENT_STREAM) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingInternalDate() { assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .content(CONTENT_STREAM) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingBodyStartOctets() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .internalDate(internalDate) .size(SIZE) .content(CONTENT_STREAM) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingSize() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .content(CONTENT_STREAM) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingContent() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .flags(new Flags()) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingFlags() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .content(CONTENT_STREAM) .propertyBuilder(new PropertyBuilder()) .build()) .isInstanceOf(NullPointerException.class); }
@Test void buildShouldThrowOnMissingProperties() { Date internalDate = new Date(); assertThatThrownBy(() -> SimpleMailboxMessage.builder() .messageId(MESSAGE_ID) .mailboxId(TEST_ID) .internalDate(internalDate) .bodyStartOctet(BODY_START_OCTET) .size(SIZE) .content(CONTENT_STREAM) .flags(new Flags()) .build()) .isInstanceOf(NullPointerException.class); }