use of com.axway.ats.rbv.filesystem.rules.FileFolderRule in project ats-framework by Axway.
the class Test_AndRuleOperation method isMatchPriority.
@Test
public void isMatchPriority() throws RbvException, PackageException {
FileSystemMetaData meta = createMock(FileSystemMetaData.class);
FilePackage pack = createMock(FilePackage.class);
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.isFile()).andReturn(true);
// at this point the evaluation should stop since this is the first rule to
// evaluate and it fails thus the second should not be evaluated at all
// if the priority does not work then the second rule would fail the unit test
// because we are not expecting any calls it would do to the mock objects
replayAll();
FilePathRule rule = new FilePathRule("some/path/some.file", "pathRule1", true, 2);
FileFolderRule anotherRule = new FileFolderRule(false, "folderRule", true, 1);
AndRuleOperation andRule = new AndRuleOperation();
andRule.addRule(rule);
andRule.addRule(anotherRule);
assertFalse(andRule.isMatch(meta));
verifyAll();
}
use of com.axway.ats.rbv.filesystem.rules.FileFolderRule in project ats-framework by Axway.
the class FileSystemVerification method addFileCheckRule.
private void addFileCheckRule() {
// set the second highest priority for this rule - if the file path is correct the second most
// important thing is to check if the entity is a file
FileFolderRule rule = new FileFolderRule(true, "checkIsFile", true, Integer.MIN_VALUE);
rootRule.addRule(rule);
}
use of com.axway.ats.rbv.filesystem.rules.FileFolderRule in project ats-framework by Axway.
the class Test_FileFolderRule method performMatchNegative.
@Test
public void performMatchNegative() throws RbvException, PackageException {
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.isFile()).andReturn(false);
replayAll();
rule = new FileFolderRule(true, "ruleName", true);
assertFalse(rule.performMatch(meta));
verifyAll();
}
use of com.axway.ats.rbv.filesystem.rules.FileFolderRule in project ats-framework by Axway.
the class Test_FileFolderRule method performMatchException.
@Test(expected = RbvException.class)
public void performMatchException() throws RbvException, PackageException {
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.isFile()).andThrow(new PackageException(""));
replayAll();
rule = new FileFolderRule(true, "ruleName", true);
assertTrue(rule.performMatch(meta));
verifyAll();
}
Aggregations