Issue6Test: add regression test for issue 6

Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
This commit is contained in:
Paul Campbell 2016-02-16 22:26:31 +00:00
parent 850d9948ad
commit 311eda0299
2 changed files with 43 additions and 1 deletions

View file

@ -57,12 +57,18 @@
<version>1.10.19</version> <version>1.10.19</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency><!-- for Issue1Test -->
<groupId>org.codemonkey.simplejavamail</groupId> <groupId>org.codemonkey.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId> <artifactId>simple-java-mail</artifactId>
<version>2.5.1</version> <version>2.5.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency><!-- for Issue6Test -->
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.2.4.RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -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 <carl@b.com>");
message.setFrom("Bob <bob@a.com>");
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");
}
}