use of com.axway.ats.rbv.filesystem.rules.FileContentRule in project ats-framework by Axway.
the class Test_FileContentRule method isMatchNegativeException.
@Test(expected = RbvException.class)
public void isMatchNegativeException() throws Exception {
expect(testFilePackage.grep(EXPRESSION, false)).andThrow(new PackageException(""));
replayAll();
FileContentRule rule = new FileContentRule(EXPRESSION, RULE_NAME, false, true);
MetaData metaData = new FileSystemMetaData(testFilePackage);
rule.isMatch(metaData);
verifyAll();
}
use of com.axway.ats.rbv.filesystem.rules.FileContentRule in project ats-framework by Axway.
the class Test_FileContentRule method isMatchRegularExpression.
@Test
public void isMatchRegularExpression() throws Exception {
expect(testFilePackage.grep(EXPRESSION, true)).andReturn(new String[] { EXPRESSION });
replayAll();
FileContentRule rule = new FileContentRule(EXPRESSION, RULE_NAME, true, true);
MetaData metaData = new FileSystemMetaData(testFilePackage);
assertTrue(rule.isMatch(metaData));
verifyAll();
}
use of com.axway.ats.rbv.filesystem.rules.FileContentRule in project ats-framework by Axway.
the class FileSystemVerification method checkContents.
/**
* Add rule to check if the file contains (or does not contain) the specified expression.
* Accepts both regular expressions and simple strings.
*
* @param expression the expression to look for
* @param isRegularExpression true if the expression is a regular expression
* @param expectedResult whether or not we would expect the expression to be present in the file
* @throws RbvException thrown on error
*/
@PublicAtsApi
public void checkContents(String expression, boolean isRegularExpression, boolean expectedResult) throws RbvException {
FileContentRule rule = new FileContentRule(expression, "checkContents", isRegularExpression, expectedResult);
rootRule.addRule(rule);
}
use of com.axway.ats.rbv.filesystem.rules.FileContentRule in project ats-framework by Axway.
the class Test_FileContentRule method isMatchNegative.
@Test
public void isMatchNegative() throws Exception {
expect(testFilePackage.grep(EXPRESSION, false)).andReturn(new String[0]);
replayAll();
FileContentRule rule = new FileContentRule(EXPRESSION, RULE_NAME, false, true);
MetaData metaData = new FileSystemMetaData(testFilePackage);
assertFalse(rule.isMatch(metaData));
verifyAll();
}
use of com.axway.ats.rbv.filesystem.rules.FileContentRule in project ats-framework by Axway.
the class Test_FileContentRule method getMetaDataKeys.
@Test
public void getMetaDataKeys() throws Exception {
replayAll();
FileContentRule rule = new FileContentRule(EXPRESSION, RULE_NAME, true, true);
ArrayList<String> expected = new ArrayList<String>();
expected.add(FileSystemMetaData.FILE_PACKAGE);
assertTrue(Arrays.equals(expected.toArray(), rule.getMetaDataKeys().toArray()));
verifyAll();
}
Aggregations