* If a list is not explicitly supplied then PIT will default to a list of common logging packages as follows *
*
* If the feature {@code FLOGCALL} is disabled, this parameter is ignored and logging calls are also mutated.
*
* @see #avoidCallsTo(String...)
*/
public PitestOperation avoidCallsTo(Collection
* If a list is not explicitly supplied then PIT will default to a list of common logging packages as follows
*
*
* 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.
*
* If a list is not explicitly supplied then PIT will default to a list of common logging packages as follows
*
*
* 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
* The algorithm cannot easily distinguish between inlined copies of code, and genuine duplicate instructions on
* the same line within a {@code finally} block.
*
* In the case of any doubt PIT will act cautiously and assume that the code is not inlined.
*
* This will be detected as two separate inlined instructions
*
* 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
* 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.
*
* 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
*
* @see #features(String...)
*/
public PitestOperation features(Collection
* 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
* 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.
*
* 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.
*
* 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.
*
* 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
* 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
* 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}.
*
* 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}.
*
* Defaults to {@code HTML}.
*
* @see #outputFormats(String...)
*/
public PitestOperation outputFormats(Collection
* 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
* For example:
*
* For example:
*
* This parameter can be used to point PIT to a top level suite or suites. Custom suites such as
* ClassPathSuite 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.
*
* This parameter can be used to point PIT to a top level suite or suites. Custom suites such as
* ClassPathSuite are supported.
*
* @see #targetTests(String...)
*/
public PitestOperation targetTests(Collection
* 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.
*
* 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}.
*
* 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.
*
* 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.
*
* Defaults to {@code false}
*/
public PitestOperation verbose(boolean isVerbose) {
if (isVerbose) {
options.put("--verbose", TRUE);
} else {
options.put("--verbose", FALSE);
}
return this;
}
}
*
*
*
*
* finally {
* int++;
* int++;
* }
*
* But this will look confusing so PIT will assume no in-lining is taking place.
*
* finally {
* int++; int++;
* }
*
* 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.
*
*
*