@Test public void getMessageIdAndEnsureSaved() throws Exception { ExtendedMimeMessage message = new ExtendedMimeMessage(); message.setText(TEST_CONTENT); message.setMessageId(TEST_MESSAGE_ID); message.writeTo(new OutputStream() { @Override public void write(int b) { } }); assertThat(message.getMessageID(), equalTo(TEST_MESSAGE_ID)); }
public void setMessageId(String messageId) { try { ensureSaved(); setHeader(MESSAGE_ID_HEADER, messageId); } catch (MessagingException e) { throw new RuntimeException(String.format("Failed to set Message ID header to [%s]", messageId), e); } }
ExtendedMimeMessage extends MimeMessage { public void setMessageId(String messageId) { try { ensureSaved(); setHeader(MESSAGE_ID_HEADER, messageId); } catch (MessagingException e) { throw new RuntimeException(String.format("Failed to set Message ID header to [%s]", messageId), e); } } }
ExtendedMimeMessage extends MimeMessage { public void setMessageId(String messageId) { try { ensureSaved(); setHeader(MESSAGE_ID_HEADER, messageId); } catch (MessagingException e) { throw new RuntimeException(String.format("Failed to set Message ID header to [%s]", messageId), e); } } ExtendedMimeMessage();  ExtendedMimeMessage(Session session, InputStream is);  ExtendedMimeMessage(MimeMessage source); }
ExtendedMimeMessage extends MimeMessage { public void setMessageId(String messageId) { try { ensureSaved(); setHeader(MESSAGE_ID_HEADER, messageId); } catch (MessagingException e) { throw new RuntimeException(String.format("Failed to set Message ID header to [%s]", messageId), e); } } ExtendedMimeMessage();  ExtendedMimeMessage(Session session, InputStream is);  ExtendedMimeMessage(MimeMessage source); static ExtendedMimeMessage wrap(MimeMessage message); boolean isEmpty(); void setType(String mailType); String getType(); void setMessageId(String messageId); boolean ensureSaved(); @Override void setHeader(String name, String value); String getUniqueMessageId(); }
ExtendedMimeMessage extends MimeMessage { public void setMessageId(String messageId) { try { ensureSaved(); setHeader(MESSAGE_ID_HEADER, messageId); } catch (MessagingException e) { throw new RuntimeException(String.format("Failed to set Message ID header to [%s]", messageId), e); } } ExtendedMimeMessage();  ExtendedMimeMessage(Session session, InputStream is);  ExtendedMimeMessage(MimeMessage source); static ExtendedMimeMessage wrap(MimeMessage message); boolean isEmpty(); void setType(String mailType); String getType(); void setMessageId(String messageId); boolean ensureSaved(); @Override void setHeader(String name, String value); String getUniqueMessageId();  }