diff --git a/config/pitest-suppressions/pitest-api-suppressions.xml b/config/pitest-suppressions/pitest-api-suppressions.xml index 52f7123f7a2..25a7a03d546 100644 --- a/config/pitest-suppressions/pitest-api-suppressions.xml +++ b/config/pitest-suppressions/pitest-api-suppressions.xml @@ -1,14 +1,5 @@ - - AbstractViolationReporter.java - com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter - setSeverity - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable severityLevel - severityLevel = SeverityLevel.getInstance(severity); - - FileContents.java com.puppycrawl.tools.checkstyle.api.FileContents diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java index 5574fcaa2f4..c0d48e7d18a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java @@ -23,6 +23,7 @@ import java.util.SortedSet; +import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; import org.junit.jupiter.api.Test; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; @@ -33,7 +34,12 @@ * Tests to ensure that default message bundle is determined correctly. * */ -public class AbstractViolationReporterTest { +public class AbstractViolationReporterTest extends AbstractModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/puppycrawl/tools/checkstyle/api/abstractviolationreporter"; + } private final AbstractCheck emptyCheck = new EmptyCheck(); @@ -79,6 +85,14 @@ public void testSeverity() throws Exception { .isEqualTo("error"); } + @Test + public void testSetSeverity() throws Exception { + final Configuration checkConfig = + createModuleConfig(SetSeverity.class); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verify(checkConfig, getPath("InputAbstractViolationReporterSetSeverity.java"), expected); + } + @Test public void testCustomMessage() throws Exception { final DefaultConfiguration config = createModuleConfig(emptyCheck.getClass()); @@ -152,4 +166,17 @@ public int[] getRequiredTokens() { } + public static class SetSeverity extends AbstractViolationReporter { + + @Override + public void log(int line, String key, Object... args) { + + } + + @Override + public void log(int line, int col, String key, Object... args) { + + } + } + } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/api/abstractviolationreporter/InputAbstractViolationReporterSetSeverity.java b/src/test/resources/com/puppycrawl/tools/checkstyle/api/abstractviolationreporter/InputAbstractViolationReporterSetSeverity.java new file mode 100644 index 00000000000..cbbaeaafcb1 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/api/abstractviolationreporter/InputAbstractViolationReporterSetSeverity.java @@ -0,0 +1,5 @@ +package com.puppycrawl.tools.checkstyle.api.abstractviolationreporter; + +public class InputAbstractViolationReporterSetSeverity { + // code +}