use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class XpathFilterElementTest method testNoQuery.
@Test
public void testNoQuery() throws Exception {
final TreeWalkerAuditEvent event = getEvent(15, 8, TokenTypes.VARIABLE_DEF);
final XpathFilterElement filter = new XpathFilterElement("InputXpathFilterElementSuppressByXpath", "Test", null, null, null);
assertWithMessage("Event should be accepted").that(filter.accept(event)).isFalse();
}
use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class XpathFilterElementTest method testNonMatchingFileRegexp.
@Test
public void testNonMatchingFileRegexp() throws Exception {
final XpathFilterElement filter = new XpathFilterElement("NonMatchingRegexp", "Test", null, null, null);
final TreeWalkerAuditEvent ev = getEvent(3, 0, TokenTypes.CLASS_DEF);
assertWithMessage("Event should be accepted").that(filter.accept(ev)).isTrue();
}
use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class XpathFilterElementTest method testNullModuleIdAndNonMatchingChecks.
@Test
public void testNullModuleIdAndNonMatchingChecks() throws Exception {
final String xpath = "NON_MATCHING_QUERY";
final XpathFilterElement filter = new XpathFilterElement("InputXpathFilterElementSuppressByXpath", "NonMatchingRegexp", null, null, xpath);
final TreeWalkerAuditEvent ev = getEvent(3, 0, TokenTypes.CLASS_DEF);
assertWithMessage("Event should be accepted").that(filter.accept(ev)).isTrue();
}
use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class XpathFilterElementTest method testNonMatchingColumnNumber.
@Test
public void testNonMatchingColumnNumber() throws Exception {
final String xpath = "//CLASS_DEF[./IDENT[@text='InputXpathFilterElementSuppressByXpath']]";
final XpathFilterElement filter = new XpathFilterElement("InputXpathFilterElementSuppressByXpath", "Test", null, null, xpath);
final TreeWalkerAuditEvent ev = getEvent(3, 100, TokenTypes.CLASS_DEF);
assertWithMessage("Event should be accepted").that(filter.accept(ev)).isTrue();
}
use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class XpathFilterElementTest method testNonMatchingCheckPattern.
@Test
public void testNonMatchingCheckPattern() throws Exception {
final Pattern pattern = Pattern.compile("NonMatchingRegexp");
final XpathFilterElement filter = new XpathFilterElement(null, pattern, null, null, null);
final TreeWalkerAuditEvent ev = getEvent(3, 0, TokenTypes.CLASS_DEF);
assertWithMessage("Event should be accepted").that(filter.accept(ev)).isTrue();
}
Aggregations