Skip to content

Issue #13672: Kill mutation for Xpath#13768

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:Xpath1
Sep 24, 2023
Merged

Issue #13672: Kill mutation for Xpath#13768
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:Xpath1

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Sep 23, 2023

Issue #13672: Kill mutation for Xpath


Mutation

<mutation unstable="true">
<sourceFile>AbstractRootNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.AbstractRootNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_5</mutator>
<description>RemoveSwitch 5 (case value 5)</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>
<mutation unstable="true">
<sourceFile>AbstractRootNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.AbstractRootNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_8</mutator>
<description>RemoveSwitch 8 (case value 8)</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>

and
<mutation unstable="false">
<sourceFile>AbstractElementNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode</mutatedClass>
<mutatedMethod>getPrecedingSiblings</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Collections::unmodifiableList with argument</description>
<lineContent>return Collections.unmodifiableList(siblings.subList(0, indexAmongSiblings));</lineContent>
</mutation>


Explaination

Test added

<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_8</mutator>
<description>RemoveSwitch 8 (case value 8)</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their is no case in which the case value 8 is used

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item:

@Kevin222004 Kevin222004 force-pushed the Xpath1 branch 2 times, most recently from d448fd0 to fa12594 Compare September 24, 2023 09:19
Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last:

Comment on lines +2 to +15
com.puppycrawl.tools.checkstyle.filters.SuppressionXpathFilter
file = (file)InputAbstractRootNode.xml
optional = (default)false

com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck
format = [^a-zA-z0-9]*
ignoreCase = (default)false
message = (default)
tokens = CHAR_LITERAL

*/
package com.puppycrawl.tools.checkstyle.xpath.abstractrootnode;

public class InputAbstractRootNode {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SuppressionXpathFilter vs InputAbstractRootNode is red flag.

please move this code to SuppressionXpathFilterTest.
fact that we have some abstract class does not mean that we need to test is as abstract. We test all from user perspective, user knows only SuppressionXpathFilter and amount of abstract classes or classes used by composite that are under it does not matter.

if you keep all tests at level of SuppressionXpathFilter we can refactor all easily and we will never need to change a test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

@romani romani merged commit 2371af1 into checkstyle:master Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants