From c63420270b58ced593b05e104a70cafe648458bd Mon Sep 17 00:00:00 2001 From: Shubh Srivastava Date: Wed, 12 Apr 2023 10:05:38 +0530 Subject: [PATCH] Issue #12876: Resolve pitest suppression for AbstractViolationReporter --- .../pitest-api-suppressions.xml | 9 -------- .../coding/UnusedLocalVariableCheckTest.java | 9 ++++++++ ...nusedLocalVariableTestWarningSeverity.java | 23 +++++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unusedlocalvariable/InputUnusedLocalVariableTestWarningSeverity.java 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/checks/coding/UnusedLocalVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java index 5b321276d58..97cf08fd26c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheckTest.java @@ -241,6 +241,15 @@ public void testUnusedLocalVarNestedClasses3() throws Exception { expected); } + @Test + public void testUnusedLocalVarTestWarningSeverity() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWithInlineConfigParser( + getPath("InputUnusedLocalVariableTestWarningSeverity.java"), + expected); + } + @Test public void testUnusedLocalVarEnum() throws Exception { final String[] expected = { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unusedlocalvariable/InputUnusedLocalVariableTestWarningSeverity.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unusedlocalvariable/InputUnusedLocalVariableTestWarningSeverity.java new file mode 100644 index 00000000000..2a544d1b9e3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unusedlocalvariable/InputUnusedLocalVariableTestWarningSeverity.java @@ -0,0 +1,23 @@ +/* +UnusedLocalVariable +severity = warning + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.coding.unusedlocalvariable; + +public class InputUnusedLocalVariableTestWarningSeverity { + /* + To kill the mutation in AbstractViolationReporter in the api package, + we only had to change the severity level in the input file to warning + */ + + /* + some code + */ + +} + + +