### Question:
FilePathFileFilterRule implements FileFilterRule { @Override public boolean match(File file) { String name = file.getPath(); switch (op) { case OP_IS: return name.equals(pattern.getValue()); case OP_ISNT: return !name.equals(pattern.getValue()); case OP_CONTAINS: return name.indexOf(pattern.getValue()) >= 0; case OP_DOESNT_CONTAINS: return name.indexOf(pattern.getValue()) < 0; case OP_BEGINS_WITH: return name.startsWith(pattern.getValue()); case OP_DOESNT_BEGINS_WITH: return !name.startsWith(pattern.getValue()); case OP_ENDS_WITH: return name.endsWith(pattern.getValue()); case OP_DOESNT_ENDS_WITH: return !name.endsWith(pattern.getValue()); case OP_MATCHES_REGEXP: return regexppattern.matcher(name).matches(); case OP_DOESNT_MATCHES_REGEXP: return !regexppattern.matcher(name).matches(); default: return false; } } FilePathFileFilterRule(TextValue pattern, int operator); @Override String getRuleType(); static String[] getAllOperators(); @Override int getOperator(); @Override String getOperatorName(); @Override OperandValue getValue(); @Override boolean match(File file); @Override String toString(); static final String TYPE_NAME; static final int OP_IS; static final int OP_ISNT; static final int OP_CONTAINS; static final int OP_DOESNT_CONTAINS; static final int OP_BEGINS_WITH; static final int OP_DOESNT_BEGINS_WITH; static final int OP_ENDS_WITH; static final int OP_DOESNT_ENDS_WITH; static final int OP_MATCHES_REGEXP; static final int OP_DOESNT_MATCHES_REGEXP; }### Answer:
@Test public void opMatchesRegexp() throws Exception { FilePathFileFilterRule filterRule = new FilePathFileFilterRule(new TextValue(".*"), FilePathFileFilterRule.OP_MATCHES_REGEXP); assertTrue(filterRule.match(testNode)); }