Skip to content

Conver test from XpathFilterElementTest to SuppressionXpathSingleFilterTest to use inlined config in Input files #11440

@romani

Description

@romani

Detected at https://github.com/checkstyle/checkstyle/pull/11437/files

All filters should migrate to use config inlined in Input files.
Suppression that was left in that commit should be removed.

we should not have not real tests, we should cover all functionalilty by full functional tests, to make sure xpath works to match real nodes.

all tests from XpathFilterElementTest should be converted to tests in SuppressionXpathSingleFilterTest where we load whole Input file with Check and Filter in header of file and confirm that violation is suppressed on required node.

Analysis from @Carbon14-48

testNonMatchingTokenType :


Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "isXpathQueryMatching"
Line Contents: "isMatching = abstractNode.getTokenType() == event.getTokenType()"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF"
Description: "removed conditional - replaced equality check with true"
Line Number: 173

testNonMatchingColumnNumber:

Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "isXpathQueryMatching"
Line Contents: "&& abstractNode.getColumnNumber() == event.getColumnCharIndex();"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF"
Description: "removed conditional - replaced equality check with true"
Line Number: 175

testNullFileName:

Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "isFileNameAndModuleAndModuleNameMatching"
Line Contents: "return event.fileName() != null"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF"
Description: "removed conditional - replaced equality check with true"
Line Number: 138

testNonMatchingFileRegexp:

Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "<init>"
Line Contents: "this(Optional.ofNullable(files).map(Pattern::compile).orElse(null),"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator"
Description: "removed call to java/util/Optional::orElse"
Line Number: 79

Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "<init>"
Line Contents: "this(Optional.ofNullable(files).map(Pattern::compile).orElse(null),"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator"
Description: "replaced call to java/util/Optional::orElse with argument"
Line Number: 79

testNullViolation:

Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "isFileNameAndModuleAndModuleNameMatching"
Line Contents: "&& event.violation() != null"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF"
Description: "removed conditional - replaced equality check with true"
Line Number: 140

testDecideByMessage:

Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "<init>"
Line Contents: "Optional.ofNullable(message).map(Pattern::compile).orElse(null),"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator"
Description: "removed call to java/util/Optional::orElse"
Line Number: 81
Source File: "XpathFilterElement.java"
Class: "com.puppycrawl.tools.checkstyle.filters.XpathFilterElement"
Method: "<init>"
Line Contents: "Optional.ofNullable(message).map(Pattern::compile).orElse(null),"
Mutator: "org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator"
Description: "replaced call to java/util/Optional::orElse with argument"
Line Number: 81

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions