Search in sources :

Example 1 with MimePartRule

use of com.axway.ats.rbv.imap.rules.MimePartRule in project ats-framework by Axway.

the class Test_MimePartRule method isMatchRegularPartNoSuchPart.

@Test
public void isMatchRegularPartNoSuchPart() throws PackageException, RbvException {
    mailMessage = new MimePackage(Test_MimePartRule.class.getResourceAsStream("mail_with_one_attachment.msg"));
    metaData = new ImapMetaData(mailMessage);
    //expected true
    MimePartRule rule = new MimePartRule(expectedMailMessage, 2, false, "isMatchRegularPartNoSuchPart1", true);
    assertFalse(rule.isMatch(metaData));
    //expected false
    rule = new MimePartRule(expectedMailMessage, 2, false, "isMatchRegularPartNoSuchPart2", false);
    assertTrue(rule.isMatch(metaData));
}
Also used : MimePackage(com.axway.ats.action.objects.MimePackage) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) MimePartRule(com.axway.ats.rbv.imap.rules.MimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 2 with MimePartRule

use of com.axway.ats.rbv.imap.rules.MimePartRule in project ats-framework by Axway.

the class Test_MimePartRule method isMatchRegularPartPositive.

@Test
public void isMatchRegularPartPositive() throws RbvException {
    //expected true
    MimePartRule rule = new MimePartRule(expectedMailMessage, 0, false, "isMatchRegularPartPositive1", true);
    assertTrue(rule.isMatch(metaData));
    //expected false
    rule = new MimePartRule(expectedMailMessage, 2, false, "isMatchRegularPartPositive2", false);
    assertTrue(rule.isMatch(metaData));
}
Also used : MimePartRule(com.axway.ats.rbv.imap.rules.MimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 3 with MimePartRule

use of com.axway.ats.rbv.imap.rules.MimePartRule in project ats-framework by Axway.

the class Test_MimePartRule method isMatchWrongMetaData.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchWrongMetaData() throws RbvException {
    MimePartRule rule = new MimePartRule(expectedMailMessage, 0, false, "isMatchEmptyMetaData", true);
    metaData = new MetaData();
    assertFalse(rule.isMatch(metaData));
}
Also used : ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) MetaData(com.axway.ats.rbv.MetaData) MimePartRule(com.axway.ats.rbv.imap.rules.MimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 4 with MimePartRule

use of com.axway.ats.rbv.imap.rules.MimePartRule in project ats-framework by Axway.

the class Test_MimePartRule method isMatchEmptyMetaData.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchEmptyMetaData() throws RbvException {
    MimePartRule rule = new MimePartRule(expectedMailMessage, 0, false, "isMatchEmptyMetaData", true);
    metaData = new ImapMetaData(null);
    assertFalse(rule.isMatch(metaData));
}
Also used : ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) MimePartRule(com.axway.ats.rbv.imap.rules.MimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 5 with MimePartRule

use of com.axway.ats.rbv.imap.rules.MimePartRule in project ats-framework by Axway.

the class Test_MimePartRule method isMatchAttachmentPositive.

@Test
public void isMatchAttachmentPositive() throws RbvException {
    //expected true
    MimePartRule rule = new MimePartRule(expectedMailMessage, 0, true, "isMatchAttachmentPositive1", true);
    assertTrue(rule.isMatch(metaData));
    //expected false
    rule = new MimePartRule(expectedMailMessage, 1, true, "isMatchAttachmentPositive2", false);
    assertTrue(rule.isMatch(metaData));
}
Also used : MimePartRule(com.axway.ats.rbv.imap.rules.MimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

BaseTest (com.axway.ats.rbv.BaseTest)9 MimePartRule (com.axway.ats.rbv.imap.rules.MimePartRule)9 Test (org.junit.Test)9 ImapMetaData (com.axway.ats.rbv.imap.ImapMetaData)4 MimePackage (com.axway.ats.action.objects.MimePackage)2 MetaData (com.axway.ats.rbv.MetaData)1