use of com.axway.ats.action.objects.MimePackage in project ats-framework by Axway.
the class Test_MimePackage method constructWithSessionOnly.
@Test
public void constructWithSessionOnly() throws Exception {
MimePackage message = new MimePackage();
assertEquals(0, message.getRegularPartCount());
assertEquals(0, message.getAttachmentPartCount());
}
use of com.axway.ats.action.objects.MimePackage in project ats-framework by Axway.
the class Test_MimePackage method testGetContentOfSavedMailWithAttachmentOnly.
@Test
public void testGetContentOfSavedMailWithAttachmentOnly() throws PackageException {
// expected null since attachments should not be checked for text/plain or text/html
String nestedMailPath = Test_MimePackage.class.getResource("getPlainTextBody__attachment_only.eml").getPath();
MimePackage mimePack = PackageLoader.loadMimePackageFromFile(nestedMailPath);
String contentText = mimePack.getPlainTextBody();
assertNull(contentText);
String contentHtml = mimePack.getHtmlTextBody();
assertNull(contentHtml);
}
use of com.axway.ats.action.objects.MimePackage in project ats-framework by Axway.
the class Test_MimePackage method getTagWhenNoTagIsSet.
@Test(expected = ObjectNotTaggedException.class)
public void getTagWhenNoTagIsSet() throws Exception {
MimePackage mimeMessage = new MimePackage();
mimeMessage.getTag();
}
use of com.axway.ats.action.objects.MimePackage in project ats-framework by Axway.
the class Test_MimePackage method addAttachmentsCheckContentType.
@Test
public void addAttachmentsCheckContentType() throws Exception {
MimePackage mimeMessage = new MimePackage();
mimeMessage.addAttachment(mailMessageDir + "/attachmentDir/MSADDNDR.DLL");
assertEquals("application/octet-stream", mimeMessage.getAttachmentContentType(0));
}
use of com.axway.ats.action.objects.MimePackage in project ats-framework by Axway.
the class Test_Rfc822Headers method getTextBody_HTMLBodyIsLocatedAfterAlternativePart.
/**
* Test is parsing mail with nested parts, the part 'multipart/alternative' is located before 'text/plain'
* to test that level 1 in the mail is parsed first.
*
* - multipart/mixed;
* - multipart/alternative;
* - text/plain
* - text/html
* - message/rfc822
* - text/plain
*/
@Test
public void getTextBody_HTMLBodyIsLocatedAfterAlternativePart() throws Exception {
String mailMessagePath = Test_MimePackage.class.getResource("textBody_HTMLBodyIsLocatedAfterAlternativePart.eml").getPath();
MimePackage mimeMessage = PackageLoader.loadMimePackageFromFile(mailMessagePath);
assertEquals(3, mimeMessage.getRegularPartCount());
assertEquals(1, mimeMessage.getAttachmentPartCount());
assertEquals("plain text on 1st level", mimeMessage.getPlainTextBody().trim());
assertEquals(true, mimeMessage.getHtmlTextBody().contains("test2"));
}
Aggregations