Search code examples
mavenmutation-testingpitest

pitest excludedMethods maven


I am trying to exclude PIT from mutating I/O methods, such "close" and "flush". Here is my Maven configuration:

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.1.3</version>
    <configuration>
        <targetClasses>
            <param>my.package.*.*</param>
        </targetClasses>
        <targetTests>                   
            <param>my.package.*.*</param>
        </targetTests>
        <excludedClasses>
            <param>my.generated.*</param>
            <param>**.*IT</param>                                
        </excludedClasses>
        <excludedMethods>
            <param>close</param>
            <param>flush</param>
        </excludedMethods>
        <reportSets>
            <reportSet>
                <reports>
                    <report>report</report>
                </reports>
            </reportSet>
        </reportSets>
    </configuration>
</plugin>

The excludedClasses seems to be working, but not the excludedMethods. i.e. the PIT result still says that remove the "close" and "flush" calls has no impact on the test result.

Question: What am I missing?


Solution

  • Excluded methods is used to avoid creating mutants within methods that match the supplied list of names.

    What I think you wish to do is stop creating mutants that remove calls to close and flush methods. This can be done using the avoidCallsTo parameter.