1 19 20 21 package org.apache.james.core; 22 23 import org.apache.mailet.RFC2822Headers; 24 25 import javax.mail.MessagingException ; 26 27 import java.io.ByteArrayInputStream ; 28 import java.util.Enumeration ; 29 30 import junit.framework.TestCase; 31 32 public class MailHeadersTest extends TestCase { 33 34 public void testHeadersOrder() throws MessagingException { 35 MailHeaders header = new MailHeaders(new ByteArrayInputStream ((RFC2822Headers.SUBJECT+": testsubject\r\n").getBytes())); 36 header.setHeader(RFC2822Headers.RETURN_PATH, "<test@test>"); 37 header.setHeader(RFC2822Headers.FROM, "<test2@test.de>"); 38 Enumeration h = header.getAllHeaderLines(); 39 40 assertEquals(h.nextElement(),"Return-Path: <test@test>"); 41 assertEquals(h.nextElement(),"From: <test2@test.de>"); 42 assertEquals(h.nextElement(),"Subject: testsubject"); 43 } 44 } 45 | Popular Tags |