Search in sources :

Example 16 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegularPartUTF8Positive.

@Test
public void isMatchRegularPartUTF8Positive() throws RbvException, PackageException {
    MimePackage utf8Package = new MimePackage();
    utf8Package.addPart("Изчерпателна информация", MimePackage.PART_TYPE_TEXT_PLAIN, "utf-8");
    ImapMetaData utf8MetaData = new ImapMetaData(utf8Package);
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("Изчерпателна", false, 0, false, "isMatchRegularPartPositive1", true);
    assertTrue(rule.isMatch(utf8MetaData));
    //expected false
    rule = new StringInMimePartRule("Изчерпатслна", false, 0, false, "isMatchRegularPartPositive2", false);
    assertTrue(rule.isMatch(utf8MetaData));
}
Also used : MimePackage(com.axway.ats.action.objects.MimePackage) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 17 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegexAttachmentNegative.

@Test
public void isMatchRegexAttachmentNegative() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("asd.?", true, 0, true, "isMatchRegexAttachmentNegative1", true);
    assertFalse(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("You .* now", true, 0, true, "isMatchRegexAttachmentNegative2", false);
    assertFalse(rule.isMatch(metaData));
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 18 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchNullMetaData.

@Test(expected = RbvException.class)
public void isMatchNullMetaData() throws RbvException {
    StringInMimePartRule rule = new StringInMimePartRule("US AIR FORCE", false, 2, false, "isMatchNullMetaData", false);
    assertFalse(rule.isMatch(null));
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 19 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegularPartPositive.

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

Example 20 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegexRegularPartNegative.

@Test
public void isMatchRegexRegularPartNegative() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("US .? FORCE", true, 2, false, "isMatchRegexRegularPartNegative1", true);
    assertFalse(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("US .* FORCE", true, 2, false, "isMatchRegexRegularPartNegative2", false);
    assertFalse(rule.isMatch(metaData));
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

StringInMimePartRule (com.axway.ats.rbv.imap.rules.StringInMimePartRule)20 BaseTest (com.axway.ats.rbv.BaseTest)15 Test (org.junit.Test)15 ImapMetaData (com.axway.ats.rbv.imap.ImapMetaData)6 PublicAtsApi (com.axway.ats.common.PublicAtsApi)5 MimePackage (com.axway.ats.action.objects.MimePackage)4 MetaData (com.axway.ats.rbv.MetaData)1