@Test public void getMessageHeadersShouldReturnEmptyStringWhenNoHeaders() throws Exception { MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties())); String messageHeaders = new MimeMessageUtils(message).getMessageHeaders(); assertThat(messageHeaders).isEmpty(); }
public String getMessageHeaders() throws MessagingException { Enumeration<String> heads = message.getAllHeaderLines(); StringBuilder headBuffer = new StringBuilder(1024); while (heads.hasMoreElements()) { headBuffer.append(heads.nextElement()).append("\r\n"); } return headBuffer.toString(); }
MimeMessageUtils { public String getMessageHeaders() throws MessagingException { Enumeration<String> heads = message.getAllHeaderLines(); StringBuilder headBuffer = new StringBuilder(1024); while (heads.hasMoreElements()) { headBuffer.append(heads.nextElement()).append("\r\n"); } return headBuffer.toString(); } }
MimeMessageUtils { public String getMessageHeaders() throws MessagingException { Enumeration<String> heads = message.getAllHeaderLines(); StringBuilder headBuffer = new StringBuilder(1024); while (heads.hasMoreElements()) { headBuffer.append(heads.nextElement()).append("\r\n"); } return headBuffer.toString(); } MimeMessageUtils(MimeMessage message); }
MimeMessageUtils { public String getMessageHeaders() throws MessagingException { Enumeration<String> heads = message.getAllHeaderLines(); StringBuilder headBuffer = new StringBuilder(1024); while (heads.hasMoreElements()) { headBuffer.append(heads.nextElement()).append("\r\n"); } return headBuffer.toString(); } MimeMessageUtils(MimeMessage message); Optional<String> subjectWithPrefix(String subjectPrefix); Optional<String> subjectWithPrefix(String subjectPrefix, Mail originalMail, String subject); String getMessageHeaders(); List<Header> toHeaderList(); }
MimeMessageUtils { public String getMessageHeaders() throws MessagingException { Enumeration<String> heads = message.getAllHeaderLines(); StringBuilder headBuffer = new StringBuilder(1024); while (heads.hasMoreElements()) { headBuffer.append(heads.nextElement()).append("\r\n"); } return headBuffer.toString(); } MimeMessageUtils(MimeMessage message); Optional<String> subjectWithPrefix(String subjectPrefix); Optional<String> subjectWithPrefix(String subjectPrefix, Mail originalMail, String subject); String getMessageHeaders(); List<Header> toHeaderList();  }