@Test public void testHeadersOrder() throws MessagingException { MailHeaders header = new MailHeaders(new ByteArrayInputStream((RFC2822Headers.SUBJECT + ": testsubject\r\n") .getBytes())); header.setHeader(RFC2822Headers.RETURN_PATH, "<test@test>"); header.setHeader(RFC2822Headers.FROM, "<test2@test.de>"); Enumeration<String> h = header.getAllHeaderLines(); assertThat("Return-Path: <test@test>").isEqualTo(h.nextElement()); assertThat("From: <test2@test.de>").isEqualTo(h.nextElement()); assertThat("Subject: testsubject").isEqualTo(h.nextElement()); }
@Override public synchronized void setHeader(String arg0, String arg1) { if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) { super.removeHeader(arg0); } super.setHeader(arg0, arg1); modified(); }
MailHeaders extends InternetHeaders implements Serializable, Cloneable { @Override public synchronized void setHeader(String arg0, String arg1) { if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) { super.removeHeader(arg0); } super.setHeader(arg0, arg1); modified(); } }
MailHeaders extends InternetHeaders implements Serializable, Cloneable { @Override public synchronized void setHeader(String arg0, String arg1) { if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) { super.removeHeader(arg0); } super.setHeader(arg0, arg1); modified(); } MailHeaders();  MailHeaders(InputStream in); }
MailHeaders extends InternetHeaders implements Serializable, Cloneable { @Override public synchronized void setHeader(String arg0, String arg1) { if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) { super.removeHeader(arg0); } super.setHeader(arg0, arg1); modified(); } MailHeaders();  MailHeaders(InputStream in); void writeTo(OutputStream out); byte[] toByteArray(); boolean isSet(String name); @Override synchronized void addHeader(String arg0, String arg1); @Override synchronized void setHeader(String arg0, String arg1); @Override synchronized void removeHeader(String name); @Override synchronized void addHeaderLine(String line); boolean isValid(); synchronized long getSize(); }
MailHeaders extends InternetHeaders implements Serializable, Cloneable { @Override public synchronized void setHeader(String arg0, String arg1) { if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) { super.removeHeader(arg0); } super.setHeader(arg0, arg1); modified(); } MailHeaders();  MailHeaders(InputStream in); void writeTo(OutputStream out); byte[] toByteArray(); boolean isSet(String name); @Override synchronized void addHeader(String arg0, String arg1); @Override synchronized void setHeader(String arg0, String arg1); @Override synchronized void removeHeader(String name); @Override synchronized void addHeaderLine(String line); boolean isValid(); synchronized long getSize();  }