use of com.puppycrawl.tools.checkstyle.api.SeverityLevel in project checkstyle by checkstyle.
the class SeverityMatchFilterTest method testAcceptOnMatch.
@Test
public void testAcceptOnMatch() {
filter.setSeverity(SeverityLevel.INFO);
filter.setAcceptOnMatch(false);
final AuditEvent ev = new AuditEvent(this, "Test.java");
// event with no message has severity level INFO
assertFalse("no message", filter.accept(ev));
final SeverityLevel errorLevel = SeverityLevel.ERROR;
final LocalizedMessage errorMessage = new LocalizedMessage(0, 0, "", "", null, errorLevel, null, getClass(), null);
final AuditEvent ev2 = new AuditEvent(this, "ATest.java", errorMessage);
assertTrue("level:" + errorLevel, filter.accept(ev2));
final SeverityLevel infoLevel = SeverityLevel.INFO;
final LocalizedMessage infoMessage = new LocalizedMessage(0, 0, "", "", null, infoLevel, null, getClass(), null);
final AuditEvent ev3 = new AuditEvent(this, "ATest.java", infoMessage);
assertFalse("level:" + infoLevel, filter.accept(ev3));
}
Aggregations