1 19 20 21 package org.apache.james.transport.mailets; 22 23 import java.io.UnsupportedEncodingException ; 24 import java.util.Arrays ; 25 26 import javax.mail.MessagingException ; 27 import javax.mail.internet.MimeMessage ; 28 import javax.mail.internet.ParseException ; 29 30 import junit.framework.TestCase; 31 32 import org.apache.james.test.mock.mailet.MockMail; 33 import org.apache.mailet.Mail; 34 import org.apache.mailet.MailAddress; 35 import org.apache.mailet.Mailet; 36 37 public class NullTest extends TestCase { 38 39 private MimeMessage mockedMimeMessage; 40 41 private Mail mockedMail; 42 43 private Mailet mailet; 44 45 private final String PROCESSOR = "ghost"; 46 47 public NullTest(String arg0) throws UnsupportedEncodingException { 48 super(arg0); 49 } 50 51 private void setupMockedMail(MimeMessage m) throws ParseException { 52 mockedMail = new MockMail(); 53 mockedMail.setMessage(m); 54 mockedMail.setRecipients(Arrays.asList(new MailAddress[] { 55 new MailAddress("test@james.apache.org"), 56 new MailAddress("test2@james.apache.org") })); 57 58 } 59 60 private void setupMailet() throws MessagingException { 61 mailet = new Null(); 62 } 63 64 public void testNullMailet() throws MessagingException { 66 setupMockedMail(mockedMimeMessage); 67 setupMailet(); 68 69 mailet.service(mockedMail); 70 71 assertEquals(PROCESSOR, mockedMail.getState()); 72 } 73 74 } 75 | Popular Tags |