JmapMDN { public static Builder builder() { return new Builder(); } @VisibleForTesting  JmapMDN(MessageId messageId, String subject, String textBody, String reportingUA, MDNDisposition disposition); static Builder builder(); MessageId getMessageId(); String getSubject(); String getTextBody(); ReportingUserAgent getReportingUA(); MDNDisposition getDisposition(); Message generateMDNMessage(Message originalMessage, MailboxSession mailboxSession); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); static final String DISPOSITION_NOTIFICATION_TO; static final String RETURN_PATH; }
@Test public void dispositionIsCompulsory() { assertThatThrownBy(() -> JmapMDN.builder() .messageId(MESSAGE_ID) .reportingUA(REPORTING_UA) .subject(SUBJECT) .textBody(TEXT_BODY) .build()) .isInstanceOf(IllegalStateException.class); }
@Test public void messageIdIsCompulsory() { assertThatThrownBy(() -> JmapMDN.builder() .disposition(DISPOSITION) .reportingUA(REPORTING_UA) .subject(SUBJECT) .textBody(TEXT_BODY) .build()) .isInstanceOf(IllegalStateException.class); }
@Test public void reportingUAIsCompulsory() { assertThatThrownBy(() -> JmapMDN.builder() .disposition(DISPOSITION) .messageId(MESSAGE_ID) .subject(SUBJECT) .textBody(TEXT_BODY) .build()) .isInstanceOf(IllegalStateException.class); }
@Test public void subjectIsCompulsory() { assertThatThrownBy(() -> JmapMDN.builder() .disposition(DISPOSITION) .messageId(MESSAGE_ID) .reportingUA(REPORTING_UA) .textBody(TEXT_BODY) .build()) .isInstanceOf(IllegalStateException.class); }
@Test public void textBodyIsCompulsory() { assertThatThrownBy(() -> JmapMDN.builder() .disposition(DISPOSITION) .messageId(MESSAGE_ID) .reportingUA(REPORTING_UA) .subject(SUBJECT) .build()) .isInstanceOf(IllegalStateException.class); }