Search in sources :

Example 41 with AuditEvent

use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.

the class SuppressElementTest method testDecideByFileNameAndModuleMatchingMessageNull.

@Test
public void testDecideByFileNameAndModuleMatchingMessageNull() {
    final AuditEvent ev = new AuditEvent(this, "ATest.java", null);
    assertTrue(filter.accept(ev));
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) Test(org.junit.Test)

Example 42 with AuditEvent

use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.

the class SuppressElementTest method testDecideByFileNameAndModuleMatchingCheckRegExpMatch.

@Test
public void testDecideByFileNameAndModuleMatchingCheckRegExpMatch() {
    final LocalizedMessage message = new LocalizedMessage(10, 10, "", "", null, null, getClass(), null);
    final AuditEvent ev = new AuditEvent(this, "ATest.java", message);
    filter.setChecks(getClass().getCanonicalName());
    assertFalse(filter.accept(ev));
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) LocalizedMessage(com.puppycrawl.tools.checkstyle.api.LocalizedMessage) Test(org.junit.Test)

Example 43 with AuditEvent

use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.

the class SuppressElementTest method testDecideLocalizedMessage.

@Test
public void testDecideLocalizedMessage() {
    final LocalizedMessage message = new LocalizedMessage(0, 0, "", "", null, null, getClass(), null);
    final AuditEvent ev = new AuditEvent(this, "ATest.java", message);
    //deny because there are matches on file and check names
    assertFalse("Names match", filter.accept(ev));
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) LocalizedMessage(com.puppycrawl.tools.checkstyle.api.LocalizedMessage) Test(org.junit.Test)

Example 44 with AuditEvent

use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.

the class DefaultLoggerTest method testCtorWithTwoParameters.

@Test
public void testCtorWithTwoParameters() {
    final OutputStream infoStream = new ByteArrayOutputStream();
    final DefaultLogger dl = new DefaultLogger(infoStream, true);
    dl.addException(new AuditEvent(5000, "myfile"), new IllegalStateException("upsss"));
    dl.auditFinished(new AuditEvent(6000, "myfile"));
}
Also used : OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 45 with AuditEvent

use of com.puppycrawl.tools.checkstyle.api.AuditEvent in project checkstyle by checkstyle.

the class DefaultLoggerTest method testCtor.

@Test
public void testCtor() {
    final OutputStream infoStream = new ByteArrayOutputStream();
    final OutputStream errorStream = new ByteArrayOutputStream();
    final DefaultLogger dl = new DefaultLogger(infoStream, true, errorStream, true);
    dl.addException(new AuditEvent(5000, "myfile"), new IllegalStateException("upsss"));
    dl.auditFinished(new AuditEvent(6000, "myfile"));
}
Also used : OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

AuditEvent (com.puppycrawl.tools.checkstyle.api.AuditEvent)47 Test (org.junit.Test)38 LocalizedMessage (com.puppycrawl.tools.checkstyle.api.LocalizedMessage)24 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)12 SeverityLevel (com.puppycrawl.tools.checkstyle.api.SeverityLevel)4 ArrayList (java.util.ArrayList)4 AuditListener (com.puppycrawl.tools.checkstyle.api.AuditListener)3 Checker (com.puppycrawl.tools.checkstyle.Checker)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 OutputStream (java.io.OutputStream)2 Field (java.lang.reflect.Field)2 CheckstyleCheckerListener (org.apache.maven.plugins.checkstyle.exec.CheckstyleCheckerListener)2 CheckstyleResults (org.apache.maven.plugins.checkstyle.exec.CheckstyleResults)2 Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 List (java.util.List)1 SinkEventAttributeSet (org.apache.maven.doxia.sink.SinkEventAttributeSet)1