From 311eda0299975b312706936f7e2054a136ee7af2 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 16 Feb 2016 22:26:31 +0000 Subject: [PATCH] Issue6Test: add regression test for issue 6 Signed-off-by: Paul Campbell --- pom.xml | 8 ++++- .../kemitix/wiser/assertions/Issue6Test.java | 36 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/test/java/net/kemitix/wiser/assertions/Issue6Test.java diff --git a/pom.xml b/pom.xml index b68ede7..ad634cd 100644 --- a/pom.xml +++ b/pom.xml @@ -57,12 +57,18 @@ 1.10.19 test - + org.codemonkey.simplejavamail simple-java-mail 2.5.1 test + + org.springframework + spring-context-support + 4.2.4.RELEASE + test + diff --git a/src/test/java/net/kemitix/wiser/assertions/Issue6Test.java b/src/test/java/net/kemitix/wiser/assertions/Issue6Test.java new file mode 100644 index 0000000..26329e2 --- /dev/null +++ b/src/test/java/net/kemitix/wiser/assertions/Issue6Test.java @@ -0,0 +1,36 @@ +package net.kemitix.wiser.assertions; + +import org.junit.Test; + +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSenderImpl; + +/** + * Regression test for issue #6. + * + * @see https://github.com/kemitix/wiser-assertions/issues/6 + * @author pcampbell + */ +public class Issue6Test extends AbstractWiserTest { + + /** + * Test {@link WiserAssertions#withContentContains(String)} where the + * message is a Spring Mail {@link SimpleMailMessage}. + */ + @Test + public void shouldMatchContentContainsFromSimpleMailMessage() { + //given + SimpleMailMessage message = new SimpleMailMessage(); + message.setTo("Carl "); + message.setFrom("Bob "); + message.setSubject("Subject"); + message.setText("Hi Carl,\n\nA new message was just posted."); + final JavaMailSenderImpl sender = new JavaMailSenderImpl(); + sender.setPort(PORT); + //when + sender.send(message); + //then + getAssertions().withContentContains("Hi Carl"); + } + +}