From 83b9a25667fbff1172df8883ed07a52210b95e61 Mon Sep 17 00:00:00 2001 From: Kevin222004 Date: Fri, 7 Oct 2022 09:44:45 +0530 Subject: [PATCH] Issue #12260: Resolve Pitest suppression for AbstractParenPadCheck - 2 --- .../pitest-whitespace-suppressions.xml | 9 ----- .../checks/whitespace/ParenPadCheckTest.java | 8 +++++ ...heckUpperCaseFunctionInOptionProperty.java | 33 +++++++++++++++++++ 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadToCheckUpperCaseFunctionInOptionProperty.java diff --git a/.ci/pitest-suppressions/pitest-whitespace-suppressions.xml b/.ci/pitest-suppressions/pitest-whitespace-suppressions.xml index eb458d8d100..c79967e433e 100644 --- a/.ci/pitest-suppressions/pitest-whitespace-suppressions.xml +++ b/.ci/pitest-suppressions/pitest-whitespace-suppressions.xml @@ -1,14 +1,5 @@ - - AbstractParenPadCheck.java - com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck - setOption - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/lang/String::toUpperCase with receiver - option = PadOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH)); - - EmptyForInitializerPadCheck.java com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java index 3b2ea7b002e..d74e229181f 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java @@ -154,6 +154,14 @@ public void testTrimOptionProperty() throws Exception { expected); } + @Test + public void testUpperCaseProperty() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser( + getPath("InputParenPadToCheckUpperCaseFunctionInOptionProperty.java"), + expected); + } + @Test public void testNospaceWithComplexInput() throws Exception { final String[] expected = { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadToCheckUpperCaseFunctionInOptionProperty.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadToCheckUpperCaseFunctionInOptionProperty.java new file mode 100644 index 00000000000..5f50e20f743 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/parenpad/InputParenPadToCheckUpperCaseFunctionInOptionProperty.java @@ -0,0 +1,33 @@ +/* +ParenPad +option = space +tokens = (default)ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, \ + ENUM_CONSTANT_DEF, EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, \ + LITERAL_NEW, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL, \ + METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA, RECORD_DEF + + +*/ + +package com.puppycrawl.tools.checkstyle.checks.whitespace.parenpad; + +public class InputParenPadToCheckUpperCaseFunctionInOptionProperty { + + public InputParenPadToCheckUpperCaseFunctionInOptionProperty ( int i ) // ok + { + this (); + toString (); + } + protected InputParenPadToCheckUpperCaseFunctionInOptionProperty() + { + super (); + } + + public void enhancedFor () + { + int[] i = new int[2]; + for ( int j: i ) { // ok + System.identityHashCode ( j ); + } + } +}