use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class XpathFilterElementTest method testNonMatchingFileNameModuleIdAndCheck.
@Test
public void testNonMatchingFileNameModuleIdAndCheck() throws Exception {
final String xpath = "NON_MATCHING_QUERY";
final XpathFilterElement filter = new XpathFilterElement("InputXpathFilterElementSuppressByXpath", null, 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 SuppressionXpathFilterTest method testAcceptOne.
@Test
public void testAcceptOne() throws Exception {
final boolean optional = false;
final SuppressionXpathFilter filter = createSuppressionXpathFilter(getPath("InputSuppressionXpathFilterNone.xml"), optional);
final TreeWalkerAuditEvent ev = new TreeWalkerAuditEvent(null, "ATest.java", null, null);
assertWithMessage("TreeWalker audit event should be accepted when there are no suppressions").that(filter.accept(ev)).isTrue();
}
use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class SuppressionXpathFilterTest method testAcceptTwo.
@Test
public void testAcceptTwo() throws Exception {
final boolean optional = false;
final SuppressionXpathFilter filter = createSuppressionXpathFilter(getPath("InputSuppressionXpathFilterIdAndQuery.xml"), optional);
final TreeWalkerAuditEvent ev = new TreeWalkerAuditEvent(null, "file1.java", null, null);
assertWithMessage("TreeWalker audit event should be accepted").that(filter.accept(ev)).isTrue();
}
use of com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent in project checkstyle by checkstyle.
the class SuppressionXpathFilterTest method testExistingSuppressionFileWithTrueOptional.
@Test
public void testExistingSuppressionFileWithTrueOptional() throws Exception {
final boolean optional = true;
final SuppressionXpathFilter filter = createSuppressionXpathFilter(getPath("InputSuppressionXpathFilterNone.xml"), optional);
final TreeWalkerAuditEvent ev = new TreeWalkerAuditEvent(null, "AnyJava.java", null, null);
assertWithMessage("Suppression file with true optional was not accepted").that(filter.accept(ev)).isTrue();
}
Aggregations