use of com.puppycrawl.tools.checkstyle.api.FileContents in project checkstyle by checkstyle.
the class SuppressionCommentFilterTest method testAcceptNullViolation.
@Test
public void testAcceptNullViolation() {
final SuppressionCommentFilter filter = new SuppressionCommentFilter();
final FileContents contents = new FileContents(new FileText(new File("filename"), Arrays.asList("//CHECKSTYLE:OFF: ConstantNameCheck", "line2")));
contents.reportSingleLineComment(1, 0);
final TreeWalkerAuditEvent auditEvent = new TreeWalkerAuditEvent(contents, null, null, null);
assertWithMessage("Filter should accept audit event").that(filter.accept(auditEvent)).isTrue();
assertWithMessage("File name should not be null").that(auditEvent.getFileName()).isNull();
}
use of com.puppycrawl.tools.checkstyle.api.FileContents in project checkstyle by checkstyle.
the class SuppressionCommentFilterTest method testAcceptNullFileContents.
@Test
public void testAcceptNullFileContents() {
final SuppressionCommentFilter filter = new SuppressionCommentFilter();
final FileContents contents = null;
final TreeWalkerAuditEvent auditEvent = new TreeWalkerAuditEvent(contents, null, new Violation(1, null, null, null, null, Object.class, null), null);
assertWithMessage("Filter should accept audit event").that(filter.accept(auditEvent)).isTrue();
}
use of com.puppycrawl.tools.checkstyle.api.FileContents in project checkstyle by checkstyle.
the class SuppressionXpathSingleFilterTest method setUp.
@BeforeEach
public void setUp() throws Exception {
file = new File(getPath("InputSuppressionXpathSingleFilter.java"));
fileContents = new FileContents(new FileText(file, StandardCharsets.UTF_8.name()));
}
use of com.puppycrawl.tools.checkstyle.api.FileContents in project checkstyle by checkstyle.
the class XpathFilterElementTest method setUp.
@BeforeEach
public void setUp() throws Exception {
file = new File(getPath("InputXpathFilterElementSuppressByXpath.java"));
fileContents = new FileContents(new FileText(file, StandardCharsets.UTF_8.name()));
}
Aggregations