Inital commit

This commit is contained in:
Erik C. Thauvin 2023-08-29 08:47:13 -07:00
commit 739446ce63
56 changed files with 3401 additions and 0 deletions

32
.github/workflows/bld.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: bld-ci
on: [ push, pull_request, workflow_dispatch ]
jobs:
build-bld-project:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17, 20 ]
steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for bld
run: chmod +x bld
- name: Download the dependencies
run: ./bld download
- name: Run tests with bld
run: ./bld compile test

57
.github/workflows/pages.yml vendored Normal file
View file

@ -0,0 +1,57 @@
name: javadocs-pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Build Javadocs
run: ./bld download clean javadoc
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload generated Javadocs repository
path: 'build/javadoc/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

58
.gitignore vendored Normal file
View file

@ -0,0 +1,58 @@
.gradle
.DS_Store
build
lib/bld/**
!lib/bld/bld-wrapper.jar
!lib/bld/bld-wrapper.properties
lib/compile/
lib/runtime/
lib/standalone/
lib/test/
# IDEA ignores
# User-specific
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Editor-based Rest Client
.idea/httpRequests
# Local Properties
local.properties

3
.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

29
.idea/app.iml generated Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/main" />
<output-test url="file://$MODULE_DIR$/build/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="RUNTIME">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="compile" level="project" />
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
<orderEntry type="library" scope="TEST" name="test" level="project" />
</component>
</module>

14
.idea/bld.iml generated Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/bld" />
<output-test url="file://$MODULE_DIR$/build/bld" />
<exclude-output />
<content url="file://$MODULE_DIR$/src/bld">
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bld" level="project" />
</component>
</module>

6
.idea/copyright/Apache_License.xml generated Normal file
View file

@ -0,0 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright &amp;#36;today.year the original author or authors.&#10; &#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; https://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="myName" value="Apache License" />
</copyright>
</component>

3
.idea/copyright/profiles_settings.xml generated Normal file
View file

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="Apache License" />
</component>

View file

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
</profile>
</component>

17
.idea/libraries/bld.xml generated Normal file
View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
</excluded>
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>

13
.idea/libraries/compile.xml generated Normal file
View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="compile">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

14
.idea/libraries/runtime.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="runtime">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
<root url="file://$PROJECT_DIR$/src/main/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

14
.idea/libraries/test.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="test">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

21
.idea/misc.xml generated Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<pattern value="rife.bld.extension.PitestOperationBuild" method="jacoco" />
<pattern value="rife.bld.extension.PitestOperationBuild" />
<pattern value="rife.bld.extension.PitestOperationBuild" method="pmd" />
</component>
<component name="PDMPlugin">
<option name="customRuleSets">
<list>
<option value="K:\java\semver\config\pmd.xml" />
<option value="$PROJECT_DIR$/../bld-pmd/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" />
</list>
</option>
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>

9
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
</modules>
</component>
</project>

9
.idea/runConfigurations/Run Tests.xml generated Normal file
View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="rife.bld.extension.PitestExtensionTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

6
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

11
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "rife.bld.extension.PitestExtensionTest"
}
]
}

15
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.2.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

177
LICENSE.txt Normal file
View file

@ -0,0 +1,177 @@
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

47
README.md Executable file
View file

@ -0,0 +1,47 @@
# [PIT Mutation Testing](https://pitest.org/) Extension for [b<span style="color:orange">l</span>d](https://rife2.com/bldb)
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![bld](https://img.shields.io/badge/1.7.2-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![Release](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/releases/com/uwyn/rife2/bld-pitest/maven-metadata.xml?color=blue)](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-pitest)
[![Snapshot](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/snapshots/com/uwyn/rife2/bld-pitest/maven-metadata.xml?label=snapshot)](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-pitest)
[![GitHub CI](https://github.com/rife2/bld-pitest/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-pitest/actions/workflows/bld.yml)
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
To run mutation tests and coverage, add the following to your build file:
```java
@BuildCommand(summary = "Run PIT mutation tests")
public void pit() throws Exception {
new PitestOperation()
.fromProject(this)
.reportDir(Path.of("reports", "mutations").toString())
.targetClasses(pkg + ".*")
.targetTests(pkg + ".*")
.verbose(true)
.execute();
}
```
```
./bld compile pit
```
- [View Examples](https://github.com/rife2/bld-pittest/blob/master/examples/src/bld/java/com/example/)
Please check the [PitestOperation documentation](https://rife2.github.io/bld-pitest/rife/bld/extension/PitestOperation.html#method-summary) for all available configuration options.
### Pitest (PIT) Dependency
Don't forget to add the Pitest `test` dependencies to your build file, as they are not provided by the extension. For example:
```java
repositories = List.of(MAVEN_CENTRAL);
scope(test)
.include(dependency("org.pitest", "pitest", version(1, 14, 4)))
.include(dependency("org.pitest", "pitest-command-line", version(1, 14, 4)))
.include(dependency("org.pitest", "pitest-junit5-plugin", version(1, 2, 0)))
.include(dependency("org.pitest", "pitest-testng-plugin", version(1, 0, 0)));
```

2
bld Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build rife.bld.extension.PitestOperationBuild "$@"

4
bld.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build rife.bld.extension.PitestOperationBuild %*

109
config/pmd.xml Normal file
View file

@ -0,0 +1,109 @@
<?xml version="1.0"?>
<ruleset name="erik"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Erik's Ruleset</description>
<!-- BEST PRACTICES -->
<rule ref="category/java/bestpractices.xml">
<exclude name="AvoidPrintStackTrace"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="GuardLogStatement"/>
</rule>
<rule ref="category/java/bestpractices.xml/MissingOverride">
<properties>
<property name="violationSuppressXPath"
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
</properties>
</rule>
<!-- CODE STYLE -->
<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="ClassNamingConventions"/>
<exclude name="ConfusingTernary"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="FieldNamingConventions"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PackageCase"/>
<exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="UselessParentheses"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
</rule>
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
<properties>
<property name="violationSuppressRegex" value="Unused (static|.*\.\*).*"/>
</properties>
</rule>
<!-- DESIGN -->
<rule ref="category/java/design.xml">
<exclude name="AvoidCatchingGenericException"/>
<exclude name="AvoidDeeplyNestedIfStmts"/>
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
<exclude name="CognitiveComplexity"/>
<exclude name="CyclomaticComplexity"/>
<exclude name="ExcessiveClassLength"/>
<exclude name="ExcessiveMethodLength"/>
<exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="GodClass"/>
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
<exclude name="NPathComplexity"/>
<exclude name="NcssCount"/>
<exclude name="TooManyFields"/>
<exclude name="TooManyMethods"/>
<exclude name="UseObjectForClearerAPI"/>
</rule>
<!-- DOCUMENTATION -->
<rule ref="category/java/documentation.xml">
<exclude name="CommentRequired"/>
<exclude name="CommentSize"/>
</rule>
<!-- ERROR PRONE -->
<rule ref="category/java/errorprone.xml">
<exclude name="AssignmentInOperand"/>
<exclude name="AvoidCatchingNPE"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="NullAssignment"/>
</rule>
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
<properties>
<property name="allowWhile" value="true"/>
<property name="allowFor" value="true"/>
<property name="allowIf" value="true"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
<properties>
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<!-- MULTITHREADING -->
<rule ref="category/java/multithreading.xml">
</rule>
<!-- PERFORMANCE -->
<rule ref="category/java/performance.xml">
</rule>
<!-- SECURITY -->
<rule ref="category/java/security.xml">
</rule>
</ruleset>

55
examples/.gitignore vendored Normal file
View file

@ -0,0 +1,55 @@
.gradle
.DS_Store
build
lib/bld/**
!lib/bld/bld-wrapper.jar
!lib/bld/bld-wrapper.properties
lib/compile/
lib/runtime/
lib/standalone/
lib/test/
# IDEA ignores
# User-specific
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Editor-based Rest Client
.idea/httpRequests

3
examples/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

29
examples/.idea/app.iml generated Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/main" />
<output-test url="file://$MODULE_DIR$/build/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="RUNTIME">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="compile" level="project" />
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
<orderEntry type="library" scope="TEST" name="test" level="project" />
</component>
</module>

14
examples/.idea/bld.iml generated Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/bld" />
<output-test url="file://$MODULE_DIR$/build/bld" />
<exclude-output />
<content url="file://$MODULE_DIR$/src/bld">
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bld" level="project" />
</component>
</module>

View file

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
</profile>
</component>

17
examples/.idea/libraries/bld.xml generated Normal file
View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
</excluded>
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>

13
examples/.idea/libraries/compile.xml generated Normal file
View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="compile">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

14
examples/.idea/libraries/runtime.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="runtime">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
<root url="file://$PROJECT_DIR$/src/main/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

14
examples/.idea/libraries/test.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="test">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

13
examples/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<pattern value="com.example.ExamplesBuild" />
<pattern value="com.example.ExamplesBuild" method="pit" />
</component>
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>

9
examples/.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.example.ExamplesTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

6
examples/.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

11
examples/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "com.example.ExamplesTest"
}
]
}

15
examples/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.2.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

2
examples/bld Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build com.example.ExamplesBuild "$@"

4
examples/bld.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build com.example.ExamplesBuild %*

Binary file not shown.

View file

@ -0,0 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extensions=com.uwyn.rife2:bld-pitest:0.9.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.2

View file

@ -0,0 +1,166 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<h1>ExamplesLib.java</h1>
<table class="src">
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_1'/>
1
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_1'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''>package com.example;</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_2'/>
2
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_2'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''></span></pre></td></tr>
<tr>
<td class='covered'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_3'/>
3
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_3'></a>
<span>
</span>
</span>
</td>
<td class='covered'><pre><span class=''>public class ExamplesLib {</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_4'/>
4
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_4'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''> public String getMessage() {</span></pre></td></tr>
<tr>
<td class='covered'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_5'/>
5
</td>
<td class='killed'>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_5'>1</a>
<span>
1. getMessage : replaced return value with &#34;&#34; for com/example/ExamplesLib::getMessage &rarr; KILLED<br/>
</span>
</span>
</td>
<td class='covered'><pre><span class='killed'> return &#34;Hello World!&#34;;</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_6'/>
6
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_6'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''> }</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@5609159b_7'/>
7
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_7'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''>}</span></pre></td></tr>
<tr><td></td><td></td><td><h2>Mutations</h2></td></tr>
<tr>
<td><a href='#org.pitest.mutationtest.report.html.SourceFile@5609159b_5'>5</a></td>
<td></td>
<td>
<a name='grouporg.pitest.mutationtest.report.html.SourceFile@5609159b_5'/>
<p class='KILLED'><span class='pop'>1.<span><b>1</b><br/><b>Location : </b>getMessage<br/><b>Killed by : </b>com.example.ExamplesTest.[engine:junit-jupiter]/[class:com.example.ExamplesTest]/[method:verifyHello()]</span></span> replaced return value with &#34;&#34; for com/example/ExamplesLib::getMessage &rarr; KILLED</p>
</td>
</tr>
</table>
<h2>Active mutators</h2>
<ul>
<li class='mutator'>CONDITIONALS_BOUNDARY</li>
<li class='mutator'>EMPTY_RETURNS</li>
<li class='mutator'>FALSE_RETURNS</li>
<li class='mutator'>INCREMENTS</li>
<li class='mutator'>INVERT_NEGS</li>
<li class='mutator'>MATH</li>
<li class='mutator'>NEGATE_CONDITIONALS</li>
<li class='mutator'>NULL_RETURNS</li>
<li class='mutator'>PRIMITIVE_RETURNS</li>
<li class='mutator'>TRUE_RETURNS</li>
<li class='mutator'>VOID_METHOD_CALLS</li>
</ul>
<h2>Tests examined</h2>
<ul>
<li>com.example.ExamplesTest.[engine:junit-jupiter]/[class:com.example.ExamplesTest]/[method:verifyHello()] (7 ms)</li>
</ul>
<br/>
Report generated by <a href='https://pitest.org'>PIT</a> 1.14.4
</body>
</html>

View file

@ -0,0 +1,241 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<h1>ExamplesTest.java</h1>
<table class="src">
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_1'/>
1
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_1'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''>package com.example;</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_2'/>
2
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_2'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''></span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_3'/>
3
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_3'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''>import org.junit.jupiter.api.Test;</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_4'/>
4
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_4'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''></span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_5'/>
5
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_5'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''>import static org.junit.jupiter.api.Assertions.assertEquals;</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_6'/>
6
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_6'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''></span></pre></td></tr>
<tr>
<td class='covered'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_7'/>
7
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_7'></a>
<span>
</span>
</span>
</td>
<td class='covered'><pre><span class=''>public class ExamplesTest {</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_8'/>
8
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_8'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''> @Test</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_9'/>
9
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_9'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''> void verifyHello() {</span></pre></td></tr>
<tr>
<td class='covered'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_10'/>
10
</td>
<td class='survived'>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_10'>1</a>
<span>
1. verifyHello : removed call to org/junit/jupiter/api/Assertions::assertEquals &rarr; SURVIVED<br/>
</span>
</span>
</td>
<td class='covered'><pre><span class='survived'> assertEquals(&#34;Hello World!&#34;, new ExamplesLib().getMessage());</span></pre></td></tr>
<tr>
<td class='covered'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_11'/>
11
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_11'></a>
<span>
</span>
</span>
</td>
<td class='covered'><pre><span class=''> }</span></pre></td></tr>
<tr>
<td class='na'>
<a name='org.pitest.mutationtest.report.html.SourceFile@2f465398_12'/>
12
</td>
<td class=''>
<span class='pop'>
<a href='#grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_12'></a>
<span>
</span>
</span>
</td>
<td class=''><pre><span class=''>}</span></pre></td></tr>
<tr><td></td><td></td><td><h2>Mutations</h2></td></tr>
<tr>
<td><a href='#org.pitest.mutationtest.report.html.SourceFile@2f465398_10'>10</a></td>
<td></td>
<td>
<a name='grouporg.pitest.mutationtest.report.html.SourceFile@2f465398_10'/>
<p class='SURVIVED'><span class='pop'>1.<span><b>1</b><br/><b>Location : </b>verifyHello<br/><b>Killed by : </b>none</span></span> removed call to org/junit/jupiter/api/Assertions::assertEquals &rarr; SURVIVED</p>
</td>
</tr>
</table>
<h2>Active mutators</h2>
<ul>
<li class='mutator'>CONDITIONALS_BOUNDARY</li>
<li class='mutator'>EMPTY_RETURNS</li>
<li class='mutator'>FALSE_RETURNS</li>
<li class='mutator'>INCREMENTS</li>
<li class='mutator'>INVERT_NEGS</li>
<li class='mutator'>MATH</li>
<li class='mutator'>NEGATE_CONDITIONALS</li>
<li class='mutator'>NULL_RETURNS</li>
<li class='mutator'>PRIMITIVE_RETURNS</li>
<li class='mutator'>TRUE_RETURNS</li>
<li class='mutator'>VOID_METHOD_CALLS</li>
</ul>
<h2>Tests examined</h2>
<ul>
<li>com.example.ExamplesTest.[engine:junit-jupiter]/[class:com.example.ExamplesTest]/[method:verifyHello()] (7 ms)</li>
</ul>
<br/>
Report generated by <a href='https://pitest.org'>PIT</a> 1.14.4
</body>
</html>

View file

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<h1>Pit Test Coverage Report</h1>
<h2>Package Summary</h2>
<h3>com.example</h3>
<table>
<thead>
<tr>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
<th>Test Strength</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>100% <div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">5/5</div></div></td>
<td>50% <div class="coverage_bar"><div class="coverage_complete width-50"></div><div class="coverage_legend">1/2</div></div></td>
<td>50% <div class="coverage_bar"><div class="coverage_complete width-50"></div><div class="coverage_legend">1/2</div></div></td>
</tr>
</tbody>
</table>
<h3>Breakdown by Class</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
<th>Test Strength</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="./ExamplesLib.java.html">ExamplesLib.java</a></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">2/2</div></div></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">1/1</div></div></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">1/1</div></div></td>
</tr>
<tr>
<td><a href="./ExamplesTest.java.html">ExamplesTest.java</a></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">3/3</div></div></td>
<td><div class="coverage_percentage">0% </div><div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/1</div></div></td>
<td><div class="coverage_percentage">0% </div><div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/1</div></div></td>
</tr>
</tbody>
</table>
<br/>
<hr/>
Report generated by <a href='https://pitest.org'>PIT</a> 1.14.4
</body>
</html>

View file

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Pit Test Coverage Report</h1>
<h3>Project Summary</h3>
<table>
<thead>
<tr>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
<th>Test Strength</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>100% <div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">5/5</div></div></td>
<td>50% <div class="coverage_bar"><div class="coverage_complete width-50"></div><div class="coverage_legend">1/2</div></div></td>
<td>50% <div class="coverage_bar"><div class="coverage_complete width-50"></div><div class="coverage_legend">1/2</div></div></td>
</tr>
</tbody>
</table>
<h3>Breakdown by Package</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
<th>Test Strength</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="./com.example/index.html">com.example</a></td>
<td>2</td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">5/5</div></div></td>
<td><div class="coverage_percentage">50% </div><div class="coverage_bar"><div class="coverage_complete width-50"></div><div class="coverage_legend">1/2</div></div></td>
<td><div class="coverage_percentage">50% </div><div class="coverage_bar"><div class="coverage_complete width-50"></div><div class="coverage_legend">1/2</div></div></td>
</tr>
</tbody>
</table>
<br/>
<hr/>
Report generated by <a href='https://pitest.org'>PIT</a> 1.14.4
<br/>
<br/>
Enhanced functionality available at <a href='https://www.arcmutate.com/'>arcmutate.com</a>
</body>
</html>

View file

@ -0,0 +1,563 @@
html, body, div, span, p, blockquote, pre {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body{
line-height: 1;
color: black;
background: white;
margin-left: 20px;
}
.src {
border: 1px solid #dddddd;
padding-top: 10px;
padding-right: 5px;
padding-left: 5px;
font-family: Consolas, Courier, monospace;
}
.covered, .COVERED {
background-color: #ddffdd;
}
.uncovered, .UNCOVERED {
background-color: #ffdddd;
}
.killed, .KILLED {
background-color: #aaffaa;
}
.survived, .SURVIVED {
background-color: #ffaaaa;
}
.uncertain, .UNCERTAIN {
background-color: #dde7ef;
}
.run_error, .RUN_ERROR {
background-color: #dde7ef;
}
.na {
background-color: #eeeeee;
}
.timed_out, .TIMED_OUT {
background-color: #dde7ef;
}
.non_viable, .NON_VIABLE {
background-color: #aaffaa;
}
.memory_error, .MEMORY_ERROR {
background-color: #dde7ef;
}
.not_started, .NO_STARTED {
background-color: #dde7ef; color : red
}
.no_coverage, .NO_COVERAGE {
background-color: #ffaaaa;
}
.tests {
width: 50%;
float: left;
}
.mutees {
float: right;
width: 50%;
}
.unit {
padding-top: 20px;
clear: both;
}
.coverage_bar {
display: inline-block;
height: 1.1em;
width: 130px;
background: #FAA;
margin: 0 5px;
vertical-align: middle;
border: 1px solid #AAA;
position: relative;
}
.coverage_complete {
display: inline-block;
height: 100%;
background: #DFD;
float: left;
}
.coverage_legend {
position: absolute;
height: 100%;
width: 100%;
left: 0;
top: 0;
text-align: center;
}
.line, .mut {
vertical-align: middle;
}
.coverage_percentage {
display: inline-block;
width: 3em;
text-align: right;
}
.pop {
outline:none;
}
.pop strong {
line-height: 30px;
}
.pop {
text-decoration: none;
}
.pop span {
z-index: 10;
display: none;
padding: 14px 20px;
margin-top: -30px;
margin-left: 28px;
width: 800px;
line-height: 16px;
word-wrap: break-word;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
-moz-box-shadow: 5px 5px 8px #CCC;
-webkit-box-shadow: 5px 5px 8px #CCC;
box-shadow: 5px 5px 8px #CCC;
}
.pop:hover span {
display: inline;
position: absolute;
color: #111;
border: 1px solid #DCA;
background: #fffAF0;
}
.width-1 {
width: 1%;
}
.width-2 {
width: 2%;
}
.width-3 {
width: 3%;
}
.width-4 {
width: 4%;
}
.width-5 {
width: 5%;
}
.width-6 {
width: 6%;
}
.width-7 {
width: 7%;
}
.width-8 {
width: 8%;
}
.width-9 {
width: 9%;
}
.width-10 {
width: 10%;
}
.width-11 {
width: 11%;
}
.width-12 {
width: 12%;
}
.width-13 {
width: 13%;
}
.width-14 {
width: 14%;
}
.width-15 {
width: 15%;
}
.width-16 {
width: 16%;
}
.width-17 {
width: 17%;
}
.width-18 {
width: 18%;
}
.width-19 {
width: 19%;
}
.width-20 {
width: 20%;
}
.width-21 {
width: 21%;
}
.width-22 {
width: 22%;
}
.width-23 {
width: 23%;
}
.width-24 {
width: 24%;
}
.width-25 {
width: 25%;
}
.width-26 {
width: 26%;
}
.width-27 {
width: 27%;
}
.width-28 {
width: 28%;
}
.width-29 {
width: 29%;
}
.width-30 {
width: 30%;
}
.width-31 {
width: 31%;
}
.width-32 {
width: 32%;
}
.width-33 {
width: 33%;
}
.width-34 {
width: 34%;
}
.width-35 {
width: 35%;
}
.width-36 {
width: 36%;
}
.width-37 {
width: 37%;
}
.width-38 {
width: 38%;
}
.width-39 {
width: 39%;
}
.width-40 {
width: 40%;
}
.width-41 {
width: 41%;
}
.width-42 {
width: 42%;
}
.width-43 {
width: 43%;
}
.width-44 {
width: 44%;
}
.width-45 {
width: 45%;
}
.width-46 {
width: 46%;
}
.width-47 {
width: 47%;
}
.width-48 {
width: 48%;
}
.width-49 {
width: 49%;
}
.width-50 {
width: 50%;
}
.width-51 {
width: 51%;
}
.width-52 {
width: 52%;
}
.width-53 {
width: 53%;
}
.width-54 {
width: 54%;
}
.width-55 {
width: 55%;
}
.width-56 {
width: 56%;
}
.width-57 {
width: 57%;
}
.width-58 {
width: 58%;
}
.width-59 {
width: 59%;
}
.width-60 {
width: 60%;
}
.width-61 {
width: 61%;
}
.width-62 {
width: 62%;
}
.width-63 {
width: 63%;
}
.width-64 {
width: 64%;
}
.width-65 {
width: 65%;
}
.width-66 {
width: 66%;
}
.width-67 {
width: 67%;
}
.width-68 {
width: 68%;
}
.width-69 {
width: 69%;
}
.width-70 {
width: 70%;
}
.width-71 {
width: 71%;
}
.width-72 {
width: 72%;
}
.width-73 {
width: 73%;
}
.width-74 {
width: 74%;
}
.width-75 {
width: 75%;
}
.width-76 {
width: 76%;
}
.width-77 {
width: 77%;
}
.width-78 {
width: 78%;
}
.width-79 {
width: 79%;
}
.width-80 {
width: 80%;
}
.width-81 {
width: 81%;
}
.width-82 {
width: 82%;
}
.width-83 {
width: 83%;
}
.width-84 {
width: 84%;
}
.width-85 {
width: 85%;
}
.width-86 {
width: 86%;
}
.width-87 {
width: 87%;
}
.width-88 {
width: 88%;
}
.width-89 {
width: 89%;
}
.width-90 {
width: 90%;
}
.width-91 {
width: 91%;
}
.width-92 {
width: 92%;
}
.width-93 {
width: 93%;
}
.width-94 {
width: 94%;
}
.width-95 {
width: 95%;
}
.width-96 {
width: 96%;
}
.width-97 {
width: 97%;
}
.width-98 {
width: 98%;
}
.width-99 {
width: 99%;
}
.width-100 {
width: 100%;
}

View file

@ -0,0 +1,46 @@
package com.example;
import rife.bld.BuildCommand;
import rife.bld.Project;
import rife.bld.extension.PitestOperation;
import rife.tools.FileUtils;
import java.nio.file.Path;
import java.util.List;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
public class ExamplesBuild extends Project {
public ExamplesBuild() {
pkg = "com.example";
name = "Examples";
version = version(0, 1, 0);
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(test)
.include(dependency("org.pitest", "pitest", version(1, 14, 4)))
.include(dependency("org.pitest", "pitest-command-line", version(1, 14, 4)))
.include(dependency("org.pitest", "pitest-junit5-plugin", version(1, 2, 0)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)));
}
public static void main(String[] args) {
new ExamplesBuild().start(args);
}
@BuildCommand(summary = "Run PIT mutation tests")
public void pit() throws Exception {
new PitestOperation()
.fromProject(this)
.reportDir(Path.of("reports", "mutations").toString())
.targetClasses(pkg + ".*")
.targetTests(pkg + ".*")
.verbose(true)
.execute();
}
}

View file

@ -0,0 +1,7 @@
package com.example;
public class ExamplesLib {
public String getMessage() {
return "Hello World!";
}
}

View file

@ -0,0 +1,12 @@
package com.example;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class ExamplesTest {
@Test
void verifyHello() {
assertEquals("Hello World!", new ExamplesLib().getMessage());
}
}

BIN
lib/bld/bld-wrapper.jar Normal file

Binary file not shown.

View file

@ -0,0 +1,8 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.2

View file

@ -0,0 +1,93 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rife.bld.extension;
import rife.bld.BuildCommand;
import rife.bld.Project;
import rife.bld.publish.PublishDeveloper;
import rife.bld.publish.PublishLicense;
import rife.bld.publish.PublishScm;
import java.io.IOException;
import java.util.List;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
import static rife.bld.dependencies.Scope.*;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class PitestOperationBuild extends Project {
public PitestOperationBuild() {
pkg = "rife.bld.extension";
name = "PitestExtension";
version = version(0, 9, 0, "SNAPSHOT");
javaRelease = 17;
downloadSources = true;
autoDownloadPurge = true;
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(compile)
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 2)));
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
javadocOperation()
.javadocOptions()
.docLint(NO_MISSING)
.link("https://rife2.github.io/bld/")
.link("https://rife2.github.io/rife2/");
publishOperation()
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
.info()
.groupId("com.uwyn.rife2")
.artifactId("bld-pitest")
.description("PIT Mutation Testing Extension for bld")
.url("https://github.com/rife2/bld-pitest")
.developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net")
.url("https://erik.thauvin.net/"))
.license(new PublishLicense().name("The Apache License, Version 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
.scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-pitest.git")
.developerConnection("scm:git:git@github.com:rife2/bld-pitest.git")
.url("https://github.com/rife2/bld-pitest"))
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
}
public static void main(String[] args) {
new PitestOperationBuild().start(args);
}
@BuildCommand(summary = "Generates JaCoCo Reports")
public void jacoco() throws IOException {
new JacocoReportOperation()
.fromProject(this)
.execute();
}
@BuildCommand(summary = "Runs PMD analysis")
public void pmd() {
new PmdOperation()
.fromProject(this)
.failOnViolation(true)
.ruleSets("config/pmd.xml")
.execute();
}
}

View file

@ -0,0 +1,733 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rife.bld.extension;
import rife.bld.BaseProject;
import rife.bld.operations.AbstractProcessOperation;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
/**
* Mutation testing and coverage with <a href="https://pittest.org">PIT</a>.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0
*/
public class PitestOperation extends AbstractProcessOperation<PitestOperation> {
protected static final String FALSE = "false";
protected static final String SOURCE_DIRS = "--sourceDirs";
protected static final String TRUE = "true";
private static final Logger LOGGER = Logger.getLogger(PitestOperation.class.getName());
/**
* The PIT options.
*/
protected final Map<String, String> options = new ConcurrentHashMap<>();
private BaseProject project_;
/**
* Line arguments for child JVMs.
*/
public PitestOperation argLine(String line) {
options.put("--argLine", line);
return this;
}
/**
* List of packages and classes which are to be considered outside the scope of mutation. Any lines of code
* containing calls to these classes will not be mutated.
* <p>
* If a list is not explicitly supplied then PIT will default to a list of common logging packages as follows
* <p>
* <ul>
* <li>java.util.logging</li>
* <li>org.apache.log4j</li>
* <li>org.slf4j</li>
* <li>org.apache.commons.logging</li>
* </ul>
* <p>
* If the feature {@code FLOGCALL} is disabled, this parameter is ignored and logging calls are also mutated.
*
* @see #avoidCallsTo(String...)
*/
public PitestOperation avoidCallsTo(Collection<String> avoidCallsTo) {
options.put("--avoidCallsTo", String.join(",", avoidCallsTo));
return this;
}
/**
* List of packages and classes which are to be considered outside the scope of mutation. Any lines of code
* containing calls to these classes will not be mutated.
* <p>
* If a list is not explicitly supplied then PIT will default to a list of common logging packages as follows
* <p>
* <ul>
* <li>java.util.logging</li>
* <li>org.apache.log4j</li>
* <li>org.slf4j</li>
* <li>org.apache.commons.logging</li>
* </ul>
* <p>
* If the feature {@code FLOGCALL} is disabled, this parameter is ignored and logging calls are also mutated.
*
* @see #avoidCallsTo(Collection)
*/
public PitestOperation avoidCallsTo(String... avoidCallTo) {
options.put("--avoidCallsTo", String.join(",", avoidCallTo));
return this;
}
/**
* List of packages and classes which are to be considered outside the scope of mutation. Any lines of code
* containing calls to these classes will not be mutated.
* <p>
* If a list is not explicitly supplied then PIT will default to a list of common logging packages as follows
* <p>
* <ul>
* <li>java.util.logging</li>
* <li>org.apache.log4j</li>
* <li>org.slf4j</li>
* <li>org.apache.commons.logging</li>
* </ul>
* <p>
* If the feature {@code FLOGCALL} is disabled, this parameter is ignored and logging calls are also mutated.
* Additional classpath entries to use when looking for tests and mutable code.
*
* @see #classPath(Collection)
*/
public PitestOperation classPath(String... path) {
options.put("--classPath", String.join(",", path));
return this;
}
/**
* Additional classpath entries to use when looking for tests and mutable code.
*
* @see #classPath(String...)
*/
public PitestOperation classPath(Collection<String> paths) {
options.put("--classPath", String.join(",", paths));
return this;
}
/**
* File with a list of additional classpath elements (one per line).
*/
public PitestOperation classPathFile(String file) {
options.put("--classPathFile", file);
return this;
}
/**
* Line coverage threshold below which the build will fail. This is an integer percent (0-100) that represents the
* fraction of the project covered by the tests.
*/
public PitestOperation coverageThreshold(int threshold) {
if (threshold >= 0 && threshold <= 100) {
options.put("--coverageThreshold", String.valueOf(threshold));
}
return this;
}
/**
* Flag to indicate if PIT should attempt to detect the inlined code generated by the java compiler in order to
* implement finally blocks. Each copy of the inlined code would normally be mutated separately, resulting in
* multiple identical looking mutations. When inlined code detection is enabled PIT will attempt to spot inlined
* code and create only a single mutation that mutates all affected instructions simultaneously.
* <p>
* The algorithm cannot easily distinguish between inlined copies of code, and genuine duplicate instructions on the same line within a finally block.
* <p>
* In the case of any doubt PIT will act cautiously and assume that the code is not inlined.
* <p>
* This will be detected as two separate inlined instructions
* <p>
* finally {
* <p>
* &nbsp;&nbsp;int++;
* <p>
* &nbsp;&nbsp;int++;
* <p>
* }
* <p>
* But this will look confusing so PIT will assume no in-lining is taking place.
* <p>
* finally {
* <p>
* &nbsp;&nbsp;int++; int++;
* </p>
* }
* <p>
* This sort of pattern might not be common with integer addition, but things like string concatenation are likely
* to produce multiple similar instructions on the same line.
* <p>
* Defaults to {@code true}
*/
public PitestOperation detectInlinedCode(boolean isDetectInlinedCode) {
if (isDetectInlinedCode) {
options.put("--detectInlinedCode", TRUE);
} else {
options.put("--detectInlinedCode", FALSE);
}
return this;
}
/**
* List of globs to match against class names. Matching classes will be excluded from mutation.
*
* @see #excludedClasses(Collection)
*/
public PitestOperation excludedClasses(String... excludedClass) {
options.put("--excludedClasses", String.join(",", excludedClass));
return this;
}
/**
* List of globs to match against class names. Matching classes will be excluded from mutation.
*
* @see #excludedClasses(String...)
*/
public PitestOperation excludedClasses(Collection<String> excludedClasses) {
options.put("--excludedClasses", String.join(",", excludedClasses));
return this;
}
/**
* List of TestNG groups/JUnit categories to include in mutation analysis. Note that only class level categories
* are supported.
*
* @see #excludedGroups(Collection)
*/
public PitestOperation excludedGroups(String... excludedGroup) {
options.put("--excludedGroups", String.join(",", excludedGroup));
return this;
}
/**
* List of TestNG groups/JUnit categories to include in mutation analysis. Note that only class level categories
* are supported.
*
* @see #excludedGroups(String...)
*/
public PitestOperation excludedGroups(Collection<String> excludedGroups) {
options.put("--excludedGroups", String.join(",", excludedGroups));
return this;
}
/**
* List of globs to match against method names. Methods matching the globs will be excluded from mutation.
*
* @see #excludedMethods(Collection)
*/
public PitestOperation excludedMethods(String... excludedMethod) {
options.put("--excludedMethods", String.join(",", excludedMethod));
return this;
}
/**
* List of globs to match against method names. Methods matching the globs will be excluded from mutation.
*
* @see #excludedMethods(String...)
*/
public PitestOperation excludedMethods(Collection<String> excludedMethods) {
options.put("--excludedMethods", String.join(",", excludedMethods));
return this;
}
/**
* List of globs to match against test class names. Matching tests will not be run (note if a test suite includes
* an excluded class, then it will leak back in).
*
* @see #excludedTests(Collection)
*/
public PitestOperation excludedTests(String... excludedTest) {
options.put("--excludedTests", String.join(",", excludedTest));
return this;
}
/**
* List of globs to match against test class names. Matching tests will not be run (note if a test suite includes
* an excluded class, then it will leak back in).
*
* @see #excludedTests(String...)
*/
public PitestOperation excludedTests(Collection<String> excludedTests) {
options.put("--excludedTests", String.join(",", excludedTests));
return this;
}
/**
* Part of the {@link #execute} operation, constructs the command list
* to use for building the process.
*/
@Override
protected List<String> executeConstructProcessCommandList() {
if (project_ == null) {
LOGGER.severe("A project must be specified.");
} else if (!options.containsKey(SOURCE_DIRS)) {
options.put(SOURCE_DIRS, project_.srcDirectory().getPath());
}
final List<String> args = new ArrayList<>();
args.add(javaTool());
args.add("-cp");
args.add(String.format("%s:%s:%s:%s", Path.of(project_.libTestDirectory().getPath(), "*"),
Path.of(project_.libCompileDirectory().getPath(), "*"), project_.buildMainDirectory(),
project_.buildTestDirectory()));
args.add("org.pitest.mutationtest.commandline.MutationCoverageReport");
options.forEach((k, v) -> {
args.add(k);
if (!v.isEmpty()) {
args.add(v);
}
});
return args;
}
/**
* Configures the operation from a {@link BaseProject}.
*
* @param project the project to configure the operation from
* @since 1.5
*/
@Override
public PitestOperation fromProject(BaseProject project) {
project_ = project;
return this;
}
/**
* Whether or not to dump per test line coverage data to disk.
* <p>
* Defaults to {@code false}
*/
public PitestOperation exportLineCoverage(boolean jsExport) {
if (jsExport) {
options.put("--exportLineCoverage", TRUE);
} else {
options.put("--exportLineCoverage", FALSE);
}
return this;
}
/**
* Whether to throw an error when no mutations found.
* <p>
* Defaults to {@code true}
*/
public PitestOperation failWhenNoMutations(boolean isFail) {
if (isFail) {
options.put("--failWhenNoMutations", TRUE);
} else {
options.put("--failWhenNoMutations", FALSE);
}
return this;
}
/**
* List of features to enable/disable
* <p>
* {@see #featrues(String)
*/
public PitestOperation features(Collection<String> feature) {
options.put("--features", String.join(",", feature));
return this;
}
/**
* List of features to enable/disable
* <p>
* {@see #featrues(String)
*/
public PitestOperation features(String... feature) {
options.put("--features", String.join(",", feature));
return this;
}
/**
* Path to a file containing history information for incremental analysis.
*/
public PitestOperation historyInputLocation(String path) {
options.put("--historyInputLocation", path);
return this;
}
/**
* Path to write history information for incremental analysis. May be the same as
* {@link #historyInputLocation(String) historyInputLocation}.
*/
public PitestOperation historyOutputLocation(String path) {
options.put("--historyOutputLocation", path);
return this;
}
/**
* Indicates if the PIT should try to mutate classes on the classpath with which it was launched. If not supplied
* this flag defaults to {@code true}. If set to {@code false} only classes found on the paths specified by the
* {@link #classPath(String...)} classPath} option will be considered.
* <p>
* Defaults to {@code true}
*/
public PitestOperation includeLaunchClasspath(boolean isLaunchClasspath) {
if (isLaunchClasspath) {
options.put("--includeLaunchClasspath", TRUE);
} else {
options.put("--includeLaunchClasspath", FALSE);
}
return this;
}
/**
* list of TestNG groups/JUnit categories to include in mutation analysis. Note that only class level categories are
* supported.
*
* @see #includedGroups(Collection)
*/
public PitestOperation includedGroups(String... includedGroup) {
options.put("--includedGroups", String.join(",", includedGroup));
return this;
}
/**
* list of TestNG groups/JUnit categories to include in mutation analysis. Note that only class level categories are
* supported.
*
* @see #includedGroups(String...)
*/
public PitestOperation includedGroups(Collection<String> includedGroups) {
options.put("--includedGroups", String.join(",", includedGroups));
return this;
}
/**
* Argument string to use when PIT launches child processes. This is most commonly used to increase the amount of
* memory available to the process, but may be used to pass any valid JVM argument.
*
* @see #jvmArgs(Collection)
*/
public PitestOperation jvmArgs(String... args) {
options.put("--jvmArgs", String.join(",", args));
return this;
}
/**
* Argument string to use when PIT launches child processes. This is most commonly used to increase the amount of
* memory available to the process, but may be used to pass any valid JVM argument.
*
* @see #jvmArgs(String...)
*/
public PitestOperation jvmArgs(Collection<String> args) {
options.put("--jvmArgs", String.join(",", args));
return this;
}
/**
* The path to the java executable to be used to launch test with. If none is supplied defaults to the one
* pointed to by {@code JAVA_HOME}.
*/
public PitestOperation jvmPath(String path) {
options.put("--jvmPath", path);
return this;
}
/**
* List of classpaths which should be considered to contain mutable code. If your build maintains separate output
* directories for tests and production classes this parameter should be set to your code output directory in order
* to avoid mutating test helper classes etc.
* <p>
* If no mutableCodePath is supplied PIT will default to considering anything not defined within a jar or zip file
* as being a candidate for mutation.
* <p>
* PIT will always attempt not to mutate test classes even if they are defined on a mutable path.
*
* @see #mutableCodePaths(Collection)
*/
public PitestOperation mutableCodePaths(String... path) {
options.put("--mutableCodePaths", String.join(",", path));
return this;
}
/**
* List of classpaths which should be considered to contain mutable code. If your build maintains separate output
* directories for tests and production classes this parameter should be set to your code output directory in order
* to avoid mutating test helper classes etc.
* <p>
* If no mutableCodePath is supplied PIT will default to considering anything not defined within a jar or zip file
* as being a candidate for mutation.
* <p>
* PIT will always attempt not to mutate test classes even if they are defined on a mutable path.
*
* @see #mutableCodePaths(String...)
*/
public PitestOperation mutableCodePaths(Collection<String> paths) {
options.put("--mutableCodePaths", String.join(",", paths));
return this;
}
/**
* Mutation score threshold below which the build will fail. This is an integer percent (0-100) that represents the
* fraction of killed mutations out of all mutations.
* <p>
* Please bear in mind that your build may contain equivalent mutations. Careful thought must therefore be given
* when selecting a threshold.
*/
public PitestOperation mutationThreshold(int threshold) {
if (threshold >= 0 && threshold <= 100) {
options.put("--mutationThreshold", String.valueOf(threshold));
}
return this;
}
/**
* List of mutation operators.
*
* @see #mutators(Collection)
*/
public PitestOperation mutators(String... mutator) {
options.put("--mutators", String.join(",", mutator));
return this;
}
/**
* List of mutation operators.
*
* @see #mutators(String...)
*/
public PitestOperation mutators(Collection<String> mutators) {
options.put("--mutators", String.join(",", mutators));
return this;
}
/**
* Output encoding.
* <p>
* Default is {@code UTF-8}.
*/
public PitestOperation outputEncoding(String encoding) {
options.put("--outputEncoding", encoding);
return this;
}
/**
* Comma separated list of formats in which to write mutation results as the mutations are analysed.
* Supported formats are {@code HTML}, {@code XML}, {@code CSV}.
* <p>
* Defaults to {@code HTML}.
*
* @see #outputFormats(Collection)
*/
public PitestOperation outputFormats(String... outputFormat) {
options.put("--outputFormats", String.join(",", outputFormat));
return this;
}
/**
* Comma separated list of formats in which to write mutation results as the mutations are analysed.
* Supported formats are {@code HTML}, {@code XML}, {@code CSV}.
* <p>
* Defaults to {@code HTML}.
*
* @see #outputFormats(String...)
*/
public PitestOperation outputFormats(Collection<String> outputFormats) {
options.put("--outputFormats", String.join(",", outputFormats));
return this;
}
/**
* Output directory for the reports.
*/
public PitestOperation reportDir(String dir) {
options.put("--reportDir", dir);
return this;
}
/**
* whether to ignore failing tests when computing coverage.
* <p>
* Default is {@code false}
*/
public PitestOperation skipFailingTests(boolean isSkipFail) {
if (isSkipFail) {
options.put("--skipFailingTests", TRUE);
} else {
options.put("--skipFailingTests", FALSE);
}
return this;
}
/**
* The folder(s) containing the source code.
*
* @see #sourceDirs(Collection)
*/
public PitestOperation sourceDirs(String... dir) {
options.put(SOURCE_DIRS, String.join(",", dir));
return this;
}
/**
* The folder(s) containing the source code.
*
* @see #sourceDirs(String...)
*/
public PitestOperation sourceDirs(Collection<String> dirs) {
options.put(SOURCE_DIRS, String.join(",", dirs));
return this;
}
/**
* The classes to be mutated. This is expressed as a list of globs.
* <p>
* For example
* <p><ul>
* <li>{@code com.myompany.*}</li>
* <li>{@code com.mycompany.package.*, com.mycompany.packageB.Foo, com.partner.*}</li>
* </ul></p>
*
* @see #targetClasses(Collection)
*/
public PitestOperation targetClasses(Collection<String> targetClass) {
options.put("--targetClasses", String.join(",", targetClass));
return this;
}
/**
* The classes to be mutated. This is expressed as a list of globs.
* <p>
* For example:
* <p><ul>
* <li>{@code com.myompany.*}</li>
* <li>{@code com.mycompany.package.*, com.mycompany.packageB.Foo, com.partner.*}</li>
* </ul></p>
*
* @see #targetClasses(String...)
*/
public PitestOperation targetClasses(String... targetClass) {
options.put("--targetClasses", String.join(",", targetClass));
return this;
}
/**
* A comma separated list of globs can be supplied to this parameter to limit the tests available to be run.
* If this parameter is not supplied then any test fixture that matched targetClasses may be used, it is however
* recommended that this parameter is always explicitly set.
* <p>
* This parameter can be used to point PIT to a top level suite or suites. Custom suites such as
* <a href="https://github.com/takari/takari-cpsuite"></a>ClassPathSuite</a> are supported.
*
* @see #targetTests(Collection)
*/
public PitestOperation targetTests(String... test) {
options.put("--targetTests", String.join(",", test));
return this;
}
/**
* A comma separated list of globs can be supplied to this parameter to limit the tests available to be run.
* If this parameter is not supplied then any test fixture that matched targetClasses may be used, it is however
* recommended that this parameter is always explicitly set.
* <p>
* This parameter can be used to point PIT to a top level suite or suites. Custom suites such as
* <a href="https://github.com/takari/takari-cpsuite"></a>ClassPathSuite</a> are supported.
*
* @see #targetTests(String...)
*/
public PitestOperation targetTests(Collection<String> tests) {
options.put("--targetTests", String.join(",", tests));
return this;
}
/**
* The number of threads to use when mutation testing.
*/
public PitestOperation threads(int threads) {
options.put("--threads", String.valueOf(threads));
return this;
}
/**
* Constant amount of additional time to allow a test to run for (after the application of the timeoutFactor)
* before considering it to be stuck in an infinite loop.
* <p>
* Defaults to {@code 4000}
*/
public PitestOperation timeoutConst(int factor) {
options.put("--timeoutConst", String.valueOf(factor));
return this;
}
/**
* A factor to apply to the normal runtime of a test when considering if it is stuck in an infinite loop.
* <p>
* Defaults to {@code 1.25}
*/
public PitestOperation timeoutFactor(double factor) {
options.put("--timeoutFactor", String.valueOf(factor));
return this;
}
/**
* By default PIT will create a date and time stamped folder for its output each time it is run. This can can make
* automation difficult, so the behaviour can be suppressed by passing {@code false}.
* <p>
* Defaults to {@code false}
*/
public PitestOperation timestampedReports(boolean isTimestamped) {
if (isTimestamped) {
options.put("--timestampedReports", TRUE);
} else {
options.put("--timestampedReports", FALSE);
}
return this;
}
/**
* Support large classpaths by creating a classpath jar.
* <p>
* Defaults to {@code false}
*/
public PitestOperation useClasspathJar(boolean isUseClasspathJar) {
if (isUseClasspathJar) {
options.put("--useClasspathJar", TRUE);
} else {
options.put("--useClasspathJar", FALSE);
}
return this;
}
/**
* Output verbose logging.
* <p>
* Defaults to {@code false}
*/
public PitestOperation verbose(boolean isVerbose) {
if (isVerbose) {
options.put("--verbose", TRUE);
} else {
options.put("--verbose", FALSE);
}
return this;
}
}

View file

@ -0,0 +1,473 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rife.bld.extension;
import org.junit.jupiter.api.Test;
import rife.bld.BaseProject;
import rife.bld.Project;
import rife.bld.WebProject;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static rife.bld.extension.PitestOperation.*;
class PitestOperationTest {
private static final String AS_LIST = "as list";
private final static String BAR = "bar";
private final static String FOO = "foo";
private final static String FOOBAR = FOO + ',' + BAR;
@Test
void argLine() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.argLine(FOO);
assertThat(op.options.get("--argLine")).isEqualTo(FOO);
}
@Test
void avoidCallsTo() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.avoidCallsTo(FOO, BAR);
assertThat(op.options.get("--avoidCallsTo")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.avoidCallsTo(List.of(FOO, BAR));
assertThat(op.options.get("--avoidCallsTo")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void classPath() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.classPath(FOO, BAR);
assertThat(op.options.get("--classPath")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.classPath(List.of(FOO, BAR));
assertThat(op.options.get("--classPath")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void classPathFile() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.classPathFile(FOO);
assertThat(op.options.get("--classPathFile")).isEqualTo(FOO);
}
@Test
void coverageThreshold() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.coverageThreshold(3);
assertThat(op.options.get("--coverageThreshold")).isEqualTo("3");
op = new PitestOperation()
.fromProject(new BaseProject())
.coverageThreshold(101);
assertThat(op.options.get("--coverageThreshold")).isNull();
}
@Test
void detectInlinedCode() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.detectInlinedCode(true);
assertThat(op.options.get("--detectInlinedCode")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.detectInlinedCode(false);
assertThat(op.options.get("--detectInlinedCode")).isEqualTo(FALSE);
}
@Test
void excludedClasses() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedClasses(FOO, BAR);
assertThat(op.options.get("--excludedClasses")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.excludedClasses(List.of(FOO, BAR));
assertThat(op.options.get("--excludedClasses")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void excludedGroups() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedGroups(FOO, BAR);
assertThat(op.options.get("--excludedGroups")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.excludedGroups(List.of(FOO, BAR));
assertThat(op.options.get("--excludedGroups")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void excludedMethods() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedMethods(FOO, BAR);
assertThat(op.options.get("--excludedMethods")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.excludedMethods(List.of(FOO, BAR));
assertThat(op.options.get("--excludedMethods")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void excludedTests() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedTests(FOO, BAR);
assertThat(op.options.get("--excludedTests")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.excludedTests(List.of(FOO, BAR));
assertThat(op.options.get("--excludedTests")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void executeConstructProcessCommandList() {
var op = new PitestOperation().
fromProject(new WebProject())
.reportDir("outputdir")
.targetClasses("com.your.package.tobemutated*")
.targetTests("com.your.package.*")
.sourceDirs("parthsource");
assertThat(String.join(" ", op.executeConstructProcessCommandList())).endsWith(
" org.pitest.mutationtest.commandline.MutationCoverageReport " +
"--targetTests com.your.package.* " +
"--reportDir outputdir " +
"--targetClasses com.your.package.tobemutated* " +
"--sourceDirs parthsource");
op = new PitestOperation()
.fromProject(new BaseProject())
.reportDir("c:\\mutationReports")
.targetClasses("example.foo.*")
.sourceDirs("c:\\myProject\\src")
.targetTests("example.foo*")
.threads(2)
.excludedMethods("hashcode", "equals");
assertThat(String.join(" ", op.executeConstructProcessCommandList())).as("mutationReports").endsWith(
"org.pitest.mutationtest.commandline.MutationCoverageReport " +
"--targetTests example.foo* " +
"--threads 2 " +
"--excludedMethods hashcode,equals " +
"--reportDir c:\\mutationReports " +
"--targetClasses example.foo.* " +
"--sourceDirs c:\\myProject\\src");
}
@Test
void exportLineCoverage() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.exportLineCoverage(true);
assertThat(op.options.get("--exportLineCoverage")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.exportLineCoverage(false);
assertThat(op.options.get("--exportLineCoverage")).isEqualTo(FALSE);
}
@Test
void failWhenNoMutations() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.failWhenNoMutations(true);
assertThat(op.options.get("--failWhenNoMutations")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.failWhenNoMutations(false);
assertThat(op.options.get("--failWhenNoMutations")).isEqualTo(FALSE);
}
@Test
void features() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.features(FOO, BAR);
assertThat(op.options.get("--features")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.features(List.of(FOO, BAR));
assertThat(op.options.get("--features")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void historyInputLocation() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.historyInputLocation(FOO);
assertThat(op.options.get("--historyInputLocation")).isEqualTo(FOO);
}
@Test
void historyOutputLocation() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.historyOutputLocation(FOO);
assertThat(op.options.get("--historyOutputLocation")).isEqualTo(FOO);
}
@Test
void includeLaunchClasspath() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.includeLaunchClasspath(true);
assertThat(op.options.get("--includeLaunchClasspath")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.includeLaunchClasspath(false);
assertThat(op.options.get("--includeLaunchClasspath")).isEqualTo(FALSE);
}
@Test
void includedGroups() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.includedGroups(FOO, BAR);
assertThat(op.options.get("--includedGroups")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.includedGroups(List.of(FOO, BAR));
assertThat(op.options.get("--includedGroups")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void jvmArgs() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.jvmArgs(FOO, BAR);
assertThat(op.options.get("--jvmArgs")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.jvmArgs(List.of(FOO, BAR));
assertThat(op.options.get("--jvmArgs")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void jvmPath() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.jvmPath(FOO);
assertThat(op.options.get("--jvmPath")).isEqualTo(FOO);
}
@Test
void mutableCodePaths() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.mutableCodePaths(FOO, BAR);
assertThat(op.options.get("--mutableCodePaths")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.mutableCodePaths(List.of(FOO, BAR));
assertThat(op.options.get("--mutableCodePaths")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void mutationThreshold() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.mutationThreshold(3);
assertThat(op.options.get("--mutationThreshold")).isEqualTo("3");
op = new PitestOperation()
.fromProject(new BaseProject())
.mutationThreshold(101);
assertThat(op.options.get("--mutationThreshold")).isNull();
}
@Test
void mutators() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.mutators(FOO, BAR);
assertThat(op.options.get("--mutators")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.mutators(List.of(FOO, BAR));
assertThat(op.options.get("--mutators")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void outputEncoding() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.outputEncoding(FOO);
assertThat(op.options.get("--outputEncoding")).isEqualTo(FOO);
}
@Test
void outputFormats() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.outputFormats(FOO, BAR);
assertThat(op.options.get("--outputFormats")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.outputFormats(List.of(FOO, BAR));
assertThat(op.options.get("--outputFormats")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void reportDir() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.reportDir(FOO);
assertThat(op.options.get("--reportDir")).isEqualTo(FOO);
}
@Test
void skipFailingTests() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.skipFailingTests(true);
assertThat(op.options.get("--skipFailingTests")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.skipFailingTests(false);
assertThat(op.options.get("--skipFailingTests")).isEqualTo(FALSE);
}
@Test
void sourceDirs() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.sourceDirs(FOO, BAR);
assertThat(op.options.get(SOURCE_DIRS)).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.sourceDirs(List.of(FOO, BAR));
assertThat(op.options.get(SOURCE_DIRS)).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void targetClasses() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.targetClasses(FOO, BAR);
assertThat(op.options.get("--targetClasses")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.targetClasses(List.of(FOO, BAR));
assertThat(op.options.get("--targetClasses")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void targetTests() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.targetTests(FOO, BAR);
assertThat(op.options.get("--targetTests")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.targetTests(List.of(FOO, BAR));
assertThat(op.options.get("--targetTests")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void threads() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.threads(3);
assertThat(op.options.get("--threads")).isEqualTo("3");
}
@Test
void timeoutConst() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.timeoutConst(300);
assertThat(op.options.get("--timeoutConst")).isEqualTo("300");
}
@Test
void timeoutFactor() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.timeoutFactor(5.25);
assertThat(op.options.get("--timeoutFactor")).isEqualTo("5.25");
}
@Test
void timestampedReports() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.timestampedReports(true);
assertThat(op.options.get("--timestampedReports")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.timestampedReports(false);
assertThat(op.options.get("--timestampedReports")).isEqualTo(FALSE);
}
@Test
void useClasspathJar() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.useClasspathJar(true);
assertThat(op.options.get("--useClasspathJar")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.useClasspathJar(false);
assertThat(op.options.get("--useClasspathJar")).isEqualTo(FALSE);
}
@Test
void verbose() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.verbose(true);
assertThat(op.options.get("--verbose")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.verbose(false);
assertThat(op.options.get("--verbose")).isEqualTo(FALSE);
}
}