Search in sources :

Example 76 with AuditEvent

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

the class SuppressWarningsHolderTest method testIsSuppressed.

@Test
public void testIsSuppressed() throws Exception {
    populateHolder("MockEntry", 100, 100, 350, 350);
    final AuditEvent event = createAuditEvent("check", 100, 10);
    assertWithMessage("Event is not suppressed").that(SuppressWarningsHolder.isSuppressed(event)).isFalse();
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) Test(org.junit.jupiter.api.Test)

Example 77 with AuditEvent

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

the class SuppressWarningsHolderTest method testIsSuppressedAfterEventStart.

@Test
public void testIsSuppressedAfterEventStart() throws Exception {
    populateHolder("check", 100, 100, 350, 350);
    final AuditEvent event = createAuditEvent("check", 100, 100);
    assertWithMessage("Event is not suppressed").that(SuppressWarningsHolder.isSuppressed(event)).isTrue();
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) Test(org.junit.jupiter.api.Test)

Example 78 with AuditEvent

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

the class SuppressWarningsHolderTest method testIsSuppressedAfterEventStart2.

@Test
public void testIsSuppressedAfterEventStart2() throws Exception {
    populateHolder("check", 100, 100, 350, 350);
    final AuditEvent event = createAuditEvent("check", 100, 0);
    assertWithMessage("Event is not suppressed").that(SuppressWarningsHolder.isSuppressed(event)).isTrue();
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) Test(org.junit.jupiter.api.Test)

Example 79 with AuditEvent

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

the class SuppressWarningsHolderTest method testIsSuppressedAfterEventEnd2.

@Test
public void testIsSuppressedAfterEventEnd2() throws Exception {
    populateHolder("check", 100, 100, 350, 350);
    final AuditEvent event = createAuditEvent("check", 400, 10);
    assertWithMessage("Event is not suppressed").that(SuppressWarningsHolder.isSuppressed(event)).isFalse();
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) Test(org.junit.jupiter.api.Test)

Example 80 with AuditEvent

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

the class SuppressWarningsHolderTest method testIsSuppressedAfterEventEnd.

@Test
public void testIsSuppressedAfterEventEnd() throws Exception {
    populateHolder("check", 100, 100, 350, 350);
    final AuditEvent event = createAuditEvent("check", 350, 352);
    assertWithMessage("Event is not suppressed").that(SuppressWarningsHolder.isSuppressed(event)).isFalse();
}
Also used : AuditEvent(com.puppycrawl.tools.checkstyle.api.AuditEvent) Test(org.junit.jupiter.api.Test)

Aggregations

AuditEvent (com.puppycrawl.tools.checkstyle.api.AuditEvent)110 Test (org.junit.jupiter.api.Test)76 Violation (com.puppycrawl.tools.checkstyle.api.Violation)51 Test (org.junit.Test)21 TreeWalkerTest (com.puppycrawl.tools.checkstyle.TreeWalkerTest)15 LocalizedMessage (com.puppycrawl.tools.checkstyle.api.LocalizedMessage)15 ByteArrayOutputStream (java.io.ByteArrayOutputStream)9 OutputStream (java.io.OutputStream)9 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 AuditListener (com.puppycrawl.tools.checkstyle.api.AuditListener)4 SeverityLevel (com.puppycrawl.tools.checkstyle.api.SeverityLevel)4 CloseAndFlushTestByteArrayOutputStream (com.puppycrawl.tools.checkstyle.internal.utils.CloseAndFlushTestByteArrayOutputStream)4 Method (java.lang.reflect.Method)3 Checker (com.puppycrawl.tools.checkstyle.Checker)2 ArrayList (java.util.ArrayList)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 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1