use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.
the class ImapVerification method checkStringInAttachment.
/**
* Check that the nested IMAP message contains the specified string in the given attachment part
*
* @param searchString the string to search for
* @param attachmentIndex the index of the attachment in the MIME structure (regular parts are skipped)
* @param nestedPackagePath path to the nested message
*/
@PublicAtsApi
public void checkStringInAttachment(String searchString, int attachmentIndex, int... nestedPackagePath) {
//create the rule
StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, searchString, false, attachmentIndex, true, "checkStringInAttachment" + getNestedMimePackagePathDescription(nestedPackagePath), true);
rootRule.addRule(stringInPartRule);
}
use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.
the class ImapVerification method checkRegexInRegularBodyPart.
/**
* Check that the nested IMAP message contains the specified regular expression in the given regular body part
*
* @param searchRegex the regular expression to search for
* @param partIndex the index of the regular part in the MIME structure (attachments are skipped)
* @param nestedPackagePath path to the nested message
*/
@PublicAtsApi
public void checkRegexInRegularBodyPart(String searchRegex, int partIndex, int... nestedPackagePath) {
//create the rule
StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, searchRegex, true, partIndex, false, "checkRegexInRegularBodyPart" + getNestedMimePackagePathDescription(nestedPackagePath), true);
rootRule.addRule(stringInPartRule);
}
use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.
the class Test_StringInMimePartRule method isMatchAttachmentPositive.
@Test
public void isMatchAttachmentPositive() throws RbvException {
//expected true
StringInMimePartRule rule = new StringInMimePartRule("You are now ready to run TOMTOM", false, 0, true, "isMatchAttachmentPositive1", true);
assertTrue(rule.isMatch(metaData));
//expected false
rule = new StringInMimePartRule("asdfasdf", false, 0, true, "isMatchAttachmentPositive2", false);
assertTrue(rule.isMatch(metaData));
}
use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.
the class Test_StringInMimePartRule method isMatchRegularPartNegative.
@Test
public void isMatchRegularPartNegative() throws RbvException {
//expected true
StringInMimePartRule rule = new StringInMimePartRule("US asdfasdf FORCE", false, 2, false, "isMatchRegularPartNegative1", true);
assertFalse(rule.isMatch(metaData));
//expected false
rule = new StringInMimePartRule("US AIR FORCE", false, 2, false, "isMatchRegularPartNegative2", false);
assertFalse(rule.isMatch(metaData));
}
use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.
the class Test_StringInMimePartRule method isMatchRegexAttachmentPositive.
@Test
public void isMatchRegexAttachmentPositive() throws RbvException {
//expected true
StringInMimePartRule rule = new StringInMimePartRule("You .* now", true, 0, true, "isMatchRegexAttachmentPositive1", true);
assertTrue(rule.isMatch(metaData));
//expected false
rule = new StringInMimePartRule("asdas.?", true, 0, true, "isMatchRegexAttachmentPositive2", false);
assertTrue(rule.isMatch(metaData));
}
Aggregations