boolean boolSaveToFile)
throws IOException
{
assertTrue(mailServer.getReceivedEmailSize() == 1);
Iterator emailIter = fakeMailServer.getReceivedEmail();
SmtpMessage emailMessage = (SmtpMessage) emailIter.next();
if (boolSaveToFile)
{
this.saveEmailToFile(emailMessage);
}
// test subject
assertEquals(strSubject, emailMessage.getHeaderValue("Subject"));
//test from address
assertEquals(fromAdd.toString(), emailMessage.getHeaderValue("From"));
//test to address
assertTrue(
toAdd.toString().indexOf(emailMessage.getHeaderValue("To")) != -1);
//test cc address
if (ccAdd.size() > 0)
{
assertTrue(
ccAdd.toString().indexOf(emailMessage.getHeaderValue("Cc"))
!= -1);
}
//test bcc address
if (bccAdd.size() > 0)
{
assertTrue(
bccAdd.toString().indexOf(emailMessage.getHeaderValue("Bcc"))
!= -1);
}
return emailMessage;
}