use of org.jvnet.mock_javamail.Mailbox in project camel by apache.
the class MailCustomContentTypeTest method testSendPlainMailContentTypeTinyTypeInHeader.
@Test
public void testSendPlainMailContentTypeTinyTypeInHeader() throws Exception {
Mailbox.clearAll();
// Camel will fixup the Content-Type if you do not have a space after the semi colon
template.sendBodyAndHeader("direct:b", "Hello World", "contentType", "text/plain;charset=iso-8859-1");
Mailbox box = Mailbox.get("claus@localhost");
Message msg = box.get(0);
// the content type should have a space after the semi colon
assertEquals("text/plain; charset=iso-8859-1", msg.getContentType());
assertEquals("Hello World", msg.getContent());
}
use of org.jvnet.mock_javamail.Mailbox in project camel by apache.
the class MailCustomContentTypeTest method testNullBody.
@Test
public void testNullBody() throws Exception {
Mailbox.clearAll();
template.sendBodyAndHeader("direct:b", null, "contentType", "text/plain; charset=iso-8859-1");
Mailbox box = Mailbox.get("claus@localhost");
Message msg = box.get(0);
assertEquals("text/plain; charset=iso-8859-1", msg.getContentType());
assertEquals("", msg.getContent());
}
use of org.jvnet.mock_javamail.Mailbox in project camel by apache.
the class MailCustomContentTypeTest method testSendHtmlMailIso88591.
@Test
public void testSendHtmlMailIso88591() throws Exception {
Mailbox.clearAll();
sendBody("direct:c", "<html><body><h1>Hello</h1>World</body></html>");
Mailbox box = Mailbox.get("claus@localhost");
Message msg = box.get(0);
assertTrue(msg.getContentType().startsWith("text/html"));
assertEquals("text/html; charset=iso-8859-1", msg.getContentType());
assertEquals("<html><body><h1>Hello</h1>World</body></html>", msg.getContent());
}
use of org.jvnet.mock_javamail.Mailbox in project camel by apache.
the class MailSearchTermNotSpamTest method testSearchTerm.
@Test
public void testSearchTerm() throws Exception {
Mailbox mailbox = Mailbox.get("bill@localhost");
assertEquals(6, mailbox.size());
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("I like riding the Camel", "Ordering Camel in Action", "Ordering ActiveMQ in Action", "We meet at 7pm the usual place");
assertMockEndpointsSatisfied();
}
use of org.jvnet.mock_javamail.Mailbox in project camel by apache.
the class MailPostProcessActionTest method testActionCalled.
@Test
public void testActionCalled() throws Exception {
Mailbox mailbox = Mailbox.get("bill@localhost");
assertEquals(1, mailbox.size());
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("TestText");
assertMockEndpointsSatisfied();
waitForActionCalled();
}
Aggregations