Skip to content

Commit 19f4925

Browse files
Kevin222004romani
authored andcommitted
Issue #13321: Kill mutation for CheckUtil-5
1 parent f9d79d0 commit 19f4925

File tree

4 files changed

+72
-16
lines changed

4 files changed

+72
-16
lines changed

config/pitest-suppressions/pitest-utils-suppressions.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@
2727
<lineContent>&amp;&amp; parent.getParent().getType() == memberType</lineContent>
2828
</mutation>
2929

30-
<mutation unstable="false">
31-
<sourceFile>CheckUtil.java</sourceFile>
32-
<mutatedClass>com.puppycrawl.tools.checkstyle.utils.CheckUtil</mutatedClass>
33-
<mutatedMethod>getAccessModifierFromModifiersToken</mutatedMethod>
34-
<mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
35-
<description>removed conditional - replaced equality check with true</description>
36-
<lineContent>if (ScopeUtil.isInEnumBlock(ast) &amp;&amp; ast.getType() == TokenTypes.CTOR_DEF) {</lineContent>
37-
</mutation>
3830

39-
<mutation unstable="false">
40-
<sourceFile>CheckUtil.java</sourceFile>
41-
<mutatedClass>com.puppycrawl.tools.checkstyle.utils.CheckUtil</mutatedClass>
42-
<mutatedMethod>getAccessModifierFromModifiersToken</mutatedMethod>
43-
<mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
44-
<description>removed conditional - replaced equality check with true</description>
45-
<lineContent>if (accessModifier == AccessModifierOption.PACKAGE) {</lineContent>
46-
</mutation>
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
4747

4848
<mutation unstable="false">
4949
<sourceFile>CheckUtil.java</sourceFile>

src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.MSG_EQUALS_AVOID_NULL;
2424
import static com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck.MSG_MULTIPLE;
2525
import static com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck.MSG_KEY;
26+
import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.MSG_EXPECTED_TAG;
2627
import static com.puppycrawl.tools.checkstyle.internal.utils.TestUtil.findTokenInAstByPredicate;
2728
import static com.puppycrawl.tools.checkstyle.internal.utils.TestUtil.isUtilsClassHasPrivateConstructor;
2829

@@ -43,6 +44,7 @@
4344
import com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck;
4445
import com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck;
4546
import com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck;
47+
import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck;
4648
import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption;
4749

4850
public class CheckUtilTest extends AbstractModuleTestSupport {
@@ -481,6 +483,23 @@ public void testNestedIfDepth() throws Exception {
481483
getPath("InputCheckUtil3.java"), expected);
482484
}
483485

486+
@Test
487+
public void testJavaDocMethod() throws Exception {
488+
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
489+
verifyWithInlineConfigParser(
490+
getPath("InputCheckUtil4.java"), expected);
491+
}
492+
493+
@Test
494+
public void testJavaDocMethod2() throws Exception {
495+
final String[] expected = {
496+
"14:25: " + getCheckMessage(JavadocMethodCheck.class,
497+
MSG_EXPECTED_TAG, "@param", "i"),
498+
};
499+
verifyWithInlineConfigParser(
500+
getPath("InputCheckUtil5.java"), expected);
501+
}
502+
484503
private DetailAST getNodeFromFile(int type) throws Exception {
485504
return getNode(JavaParser.parseFile(new File(getPath("InputCheckUtilTest.java")),
486505
JavaParser.Options.WITH_COMMENTS), type);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck
3+
accessModifiers = public
4+
5+
*/
6+
7+
package com.puppycrawl.tools.checkstyle.utils.checkutil;
8+
9+
// ok
10+
public interface InputCheckUtil4 {
11+
12+
/**
13+
* Description.
14+
*
15+
* @param it it
16+
* @param column coloumn
17+
*/
18+
private InputCheckUtil4 method(int it, int column) {
19+
return null;
20+
}
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck
3+
accessModifiers = package
4+
5+
*/
6+
7+
package com.puppycrawl.tools.checkstyle.utils.checkutil;
8+
9+
final class InputCheckUtil5 {
10+
11+
/**
12+
* Description.
13+
*/
14+
InputCheckUtil5(int i) { // violation 'Expected @param tag for 'i''
15+
}
16+
}

0 commit comments

Comments
 (0)