use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class XMLLoggerTest method testAddErrorWithNullFileName.
@Test
public void testAddErrorWithNullFileName() throws Exception {
final XMLLogger logger = new XMLLogger(outStream, OutputStreamOptions.CLOSE);
logger.auditStarted(null);
final Violation violation = new Violation(1, 1, "messages.properties", "key", null, SeverityLevel.ERROR, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, null, violation);
logger.addError(ev);
logger.auditFinished(null);
verifyXml(getPath("ExpectedXMLLoggerErrorNullFileName.xml"), outStream, violation.getViolation());
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class XMLLoggerTest method testAddError.
@Test
public void testAddError() throws Exception {
final XMLLogger logger = new XMLLogger(outStream, OutputStreamOptions.CLOSE);
logger.auditStarted(null);
final Violation violation = new Violation(1, 1, "messages.properties", "key", null, SeverityLevel.ERROR, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, "Test.java", violation);
logger.fileStarted(ev);
logger.addError(ev);
logger.fileFinished(ev);
logger.auditFinished(null);
verifyXml(getPath("ExpectedXMLLoggerError.xml"), outStream, violation.getViolation());
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class XMLLoggerTest method testAddIgnored.
@Test
public void testAddIgnored() throws Exception {
final XMLLogger logger = new XMLLogger(outStream, OutputStreamOptions.CLOSE);
logger.auditStarted(null);
final Violation violation = new Violation(1, 1, "messages.properties", "key", null, SeverityLevel.IGNORE, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, "Test.java", violation);
logger.addError(ev);
logger.auditFinished(null);
verifyXml(getPath("ExpectedXMLLoggerEmpty.xml"), outStream);
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class XMLLoggerTest method testFileFinished.
@Test
public void testFileFinished() throws Exception {
final XMLLogger logger = new XMLLogger(outStream, OutputStreamOptions.CLOSE);
logger.auditStarted(null);
final AuditEvent ev = new AuditEvent(this, "Test.java");
logger.fileFinished(ev);
logger.auditFinished(null);
verifyXml(getPath("ExpectedXMLLogger.xml"), outStream);
}
use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.
the class XMLLoggerTest method testAddExceptionBeforeFileFinished.
@Test
public void testAddExceptionBeforeFileFinished() throws Exception {
final XMLLogger logger = new XMLLogger(outStream, OutputStreamOptions.CLOSE);
logger.auditStarted(null);
final Violation violation = new Violation(1, 1, "messages.properties", null, null, null, getClass(), null);
final AuditEvent ev = new AuditEvent(this, "Test.java", violation);
logger.addException(ev, new TestException("msg", new RuntimeException("msg")));
final AuditEvent fileFinishedEvent = new AuditEvent(this, "Test.java");
logger.fileFinished(fileFinishedEvent);
logger.auditFinished(null);
verifyXml(getPath("ExpectedXMLLoggerException3.xml"), outStream);
assertWithMessage("Invalid close count").that(outStream.getCloseCount()).isEqualTo(1);
}
Aggregations