use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideByFileNameAndModuleMatchingCheckRegExpNotMatch.
@Test
public void testDecideByFileNameAndModuleMatchingCheckRegExpNotMatch() {
final LocalizedMessage message = new LocalizedMessage(10, 10, "", "", null, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, "ATest.java", message);
filter.setChecks("NON_EXISTING_CHECK");
assertTrue(filter.accept(ev));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideByLine.
@Test
public void testDecideByLine() {
final LocalizedMessage message = new LocalizedMessage(10, 10, "", "", null, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, "ATest.java", message);
//deny because there are matches on file name, check name, and line
filter.setLines("1-10");
assertFalse("In range 1-10", filter.accept(ev));
filter.setLines("1-9, 11");
assertTrue("Not in 1-9, 11", filter.accept(ev));
filter.setLines(null);
assertFalse("none", filter.accept(ev));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideByFileNameAndModuleMatchingModuleEqual.
@Test
public void testDecideByFileNameAndModuleMatchingModuleEqual() {
final LocalizedMessage message = new LocalizedMessage(10, 10, "", "", null, "MyModule", getClass(), null);
final AuditEvent ev = new AuditEvent(this, "ATest.java", message);
filter.setModuleId("MyModule");
assertFalse(filter.accept(ev));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressionCommentFilterTest method testAcceptNullLocalizedMessage.
@Test
public void testAcceptNullLocalizedMessage() {
final SuppressionCommentFilter filter = new SuppressionCommentFilter();
final AuditEvent auditEvent = new AuditEvent(this);
Assert.assertTrue(filter.accept(auditEvent));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideByFileNameAndModuleMatchingRegExpMatch.
@Test
public void testDecideByFileNameAndModuleMatchingRegExpMatch() {
final LocalizedMessage message = new LocalizedMessage(10, 10, "", "", null, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, "TestSUFFIX", message);
final SuppressElement filterWithoutChecks = new SuppressElement("Test");
assertFalse(filterWithoutChecks.accept(ev));
}
Aggregations