Skip to content

Commit

Permalink
Issue #12326: Resolve Pitest suppression for AccessModifierOption
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatSneakyCoder authored and romani committed Nov 23, 2022
1 parent 3c1c029 commit edd2b09
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-naming-suppressions.xml
Expand Up @@ -9,15 +9,6 @@
<lineContent>curNode = curNode.getNextSibling();</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>AccessModifierOption.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption</mutatedClass>
<mutatedMethod>getInstance</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/lang/String::trim with receiver</description>
<lineContent>return valueOf(AccessModifierOption.class, modifierName.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ParameterNameCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck</mutatedClass>
Expand Down
Expand Up @@ -68,6 +68,17 @@ public void testSpecified()
getPath("InputParameterNameOne.java"), expected);
}

@Test
public void testWhitespaceInAccessModifierProperty() throws Exception {
final String pattern = "^h$";
final String[] expected = {
"14:69: " + getCheckMessage(MSG_INVALID_PATTERN, "parameter1", pattern),
"18:31: " + getCheckMessage(MSG_INVALID_PATTERN, "parameter2", pattern),
};
verifyWithInlineConfigParser(
getPath("InputParameterNameWhitespaceInAccessModifierProperty.java"), expected);
}

@Test
public void testDefault()
throws Exception {
Expand Down
@@ -0,0 +1,23 @@
/*
ParameterName
format = ^h$
ignoreOverridden = (default)false
accessModifiers = \tpublic
*/

package com.puppycrawl.tools.checkstyle.checks.naming.parametername;

public class InputParameterNameWhitespaceInAccessModifierProperty {

public InputParameterNameWhitespaceInAccessModifierProperty(int parameter1) {} // violation

public void v1(int h) { // ok
new Object () {
public void i(int parameter2) {} // violation
};
}

void method2(int V3) {}
}

0 comments on commit edd2b09

Please sign in to comment.