use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressionFilterTest method testNonExistanceSuppressionFileWithTrueOptional.
@Test
public void testNonExistanceSuppressionFileWithTrueOptional() throws Exception {
final String fileName = "src/test/resources/com/puppycrawl/tools/checkstyle/filters/" + "non_existance_suppresion_file.xml";
final boolean optional = true;
final SuppressionFilter filter = createSupressionFilter(fileName, optional);
final AuditEvent ev = new AuditEvent(this, "AnyFile.java", null);
assertTrue(filter.accept(ev));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideByFileNameAndModuleMatchingModuleNotEqual.
@Test
public void testDecideByFileNameAndModuleMatchingModuleNotEqual() {
final LocalizedMessage message = new LocalizedMessage(10, 10, "", "", null, "TheirModule", getClass(), null);
final AuditEvent ev = new AuditEvent(this, "ATest.java", message);
filter.setModuleId("MyModule");
assertTrue(filter.accept(ev));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideDefault.
@Test
public void testDecideDefault() {
final AuditEvent ev = new AuditEvent(this, "Test.java");
assertTrue(ev.getFileName(), filter.accept(ev));
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class SuppressElementTest method testDecideByColumn.
@Test
public void testDecideByColumn() {
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 column
filter.setColumns("1-10");
assertFalse("In range 1-10", filter.accept(ev));
filter.setColumns("1-9, 11");
assertTrue("Not in 1-9, 1)", filter.accept(ev));
}
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));
}
Aggregations