Skip to content

Issue #13321: Kill mutation for SuppressionLoader#13396

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:suppressionLoader
Jul 14, 2023
Merged

Issue #13321: Kill mutation for SuppressionLoader#13396
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:suppressionLoader

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

Issue #13321: Kill mutation for SuppressionLoader


Mutatioins

<mutation unstable="false">
<sourceFile>CsvFilterElement.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.CsvFilterElement</mutatedClass>
<mutatedMethod>getFilters</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Collections::unmodifiableSet with argument</description>
<lineContent>return Collections.unmodifiableSet(filters);</lineContent>
</mutation>

and
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_0, DTD_SUPPRESSIONS_NAME_1_0);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_0, DTD_SUPPRESSIONS_NAME_1_0);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_1, DTD_SUPPRESSIONS_NAME_1_1);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_1, DTD_SUPPRESSIONS_NAME_1_1);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_1_XPATH, DTD_SUPPRESSIONS_NAME_1_1_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_1_XPATH, DTD_SUPPRESSIONS_NAME_1_1_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_2, DTD_SUPPRESSIONS_NAME_1_2);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_2, DTD_SUPPRESSIONS_NAME_1_2);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_2_XPATH, DTD_SUPPRESSIONS_NAME_1_2_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_CS_ID_1_2_XPATH, DTD_SUPPRESSIONS_NAME_1_2_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_0, DTD_SUPPRESSIONS_NAME_1_0);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_0, DTD_SUPPRESSIONS_NAME_1_0);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_1, DTD_SUPPRESSIONS_NAME_1_1);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_1, DTD_SUPPRESSIONS_NAME_1_1);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_1_XPATH, DTD_SUPPRESSIONS_NAME_1_1_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_1_XPATH, DTD_SUPPRESSIONS_NAME_1_1_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_2, DTD_SUPPRESSIONS_NAME_1_2);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_2, DTD_SUPPRESSIONS_NAME_1_2);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/util/Map::put</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_2_XPATH, DTD_SUPPRESSIONS_NAME_1_2_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Map::put with argument</description>
<lineContent>map.put(DTD_PUBLIC_ID_1_2_XPATH, DTD_SUPPRESSIONS_NAME_1_2_XPATH);</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>createIdToResourceNameMap</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator</mutator>
<description>replaced return value with Collections.emptyMap for com/puppycrawl/tools/checkstyle/filters/SuppressionsLoader::createIdToResourceNameMap</description>
<lineContent>return map;</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressionsLoader.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader</mutatedClass>
<mutatedMethod>getSuppressionLoader</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/lang/NumberFormatException::getMessage</description>
<lineContent>sourceName, ex.getMessage());</lineContent>
</mutation>


Explaination

Test added

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.

Items

final SuppressFilterElement suppressElement = (SuppressFilterElement) fc.getFilters()
.toArray()[0];

final String filePattern = TestUtil.getInternalState(suppressElement, "filePattern");
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.

I know that we still have a lot of bad examples of pure unit testing.
But we agreed by all that we are not doing this anymore, as it is useless code generation that doesn't not give much in quality value.

Please use Inputs with some check and suppression of violation.

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.

Ok to merge

@romani
Copy link
Copy Markdown
Member

romani commented Jul 14, 2023

Only test, so merging

@romani romani merged commit d6cee1a into checkstyle:master Jul 14, 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