diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java index 623fb2d4a7..80d496a550 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java @@ -81,7 +81,7 @@ import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.history.MessageHistory; import org.springframework.integration.mail.ImapIdleChannelAdapter.ImapIdleExceptionEvent; -import org.springframework.integration.mail.PoorMansMailServer.ImapServer; +import org.springframework.integration.mail.TestMailServer.ImapServer; import org.springframework.integration.mail.config.ImapIdleChannelAdapterParserTests; import org.springframework.integration.mail.support.DefaultMailHeaderMapper; import org.springframework.integration.test.support.LongRunningIntegrationTest; @@ -105,7 +105,7 @@ public class ImapMailReceiverTests { private final AtomicInteger failed = new AtomicInteger(0); - private final static ImapServer imapIdleServer = PoorMansMailServer.imap(0); + private final static ImapServer imapIdleServer = TestMailServer.imap(0); @BeforeClass @@ -195,6 +195,9 @@ public class ImapMailReceiverTests { equalTo("TEXT/PLAIN; charset=ISO-8859-1")); assertThat((String) received.getHeaders().get(MessageHeaders.CONTENT_TYPE), equalTo("TEXT/PLAIN; charset=ISO-8859-1")); + assertThat((String) received.getHeaders().get(MailHeaders.FROM), equalTo("Bar ")); + assertThat(((String[]) received.getHeaders().get(MailHeaders.TO))[0], equalTo("Foo ")); + assertThat((String) received.getHeaders().get(MailHeaders.SUBJECT), equalTo("Test Email")); } assertNotNull(channel.receive(10000)); // new message after idle assertNull(channel.receive(10000)); // no new message after second and third idle diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/TestMailServer.java similarity index 97% rename from spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java rename to spring-integration-mail/src/test/java/org/springframework/integration/mail/TestMailServer.java index 7952a0b10e..8822a61983 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/PoorMansMailServer.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/TestMailServer.java @@ -38,7 +38,7 @@ import org.springframework.util.Base64Utils; * @author Gary Russell * */ -public class PoorMansMailServer { +public class TestMailServer { public static SmtpServer smtp(int port) { try { @@ -282,10 +282,10 @@ public class PoorMansMailServer { write("* 1 FETCH (RFC822.SIZE 6909 INTERNALDATE \"27-May-2013 09:45:41 +0000\" " + "FLAGS (\\Seen) " + "ENVELOPE (\"Mon, 27 May 2013 15:14:49 +0530\" " - + "\"Test Email\" ((\"Foo\" NIL \"foo\" \"bar.tv\")) " + + "\"Test Email\" ((\"Bar\" NIL \"bar\" \"baz\")) " + "((\"Foo\" NIL \"foo\" \"bar.tv\")) " + "((\"Foo\" NIL \"foo\" \"bar.tv\")) " - + "((\"Bar\" NIL \"bar\" \"baz.net\")) NIL NIL " + + "((\"Foo\" NIL \"foo\" \"bar\")) NIL NIL " + "\"<4DA0A7E4.3010506@baz.net>\" " + "\"\") " + "BODYSTRUCTURE (\"TEXT\" \"PLAIN\" (\"CHARSET\" \"ISO-8859-1\") NIL NIL \"7BIT\" 1176 43)))"); @@ -433,7 +433,8 @@ public class PoorMansMailServer { public abstract class MailHandler implements Runnable { - protected static final String MESSAGE = "To: foo@bar\r\nFrom: bar@baz\r\nSubject: Test Email\r\n\r\nfoo"; + protected static final String MESSAGE = + "To: Foo \r\nFrom: Bar \r\nSubject: Test Email\r\n\r\nfoo"; protected final Socket socket; @@ -471,7 +472,7 @@ public class PoorMansMailServer { } - private PoorMansMailServer() { + private TestMailServer() { } }