Minor cleanup

This commit is contained in:
Erik C. Thauvin 2023-08-29 09:43:34 -07:00
parent 739446ce63
commit 3210364a2f
2 changed files with 27 additions and 22 deletions

View file

@ -29,7 +29,7 @@ public void pit() throws Exception {
``` ```
- [View Examples](https://github.com/rife2/bld-pittest/blob/master/examples/src/bld/java/com/example/) - [View Examples](https://github.com/rife2/bld-pitest/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. Please check the [PitestOperation documentation](https://rife2.github.io/bld-pitest/rife/bld/extension/PitestOperation.html#method-summary) for all available configuration options.

View file

@ -28,14 +28,23 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* Mutation testing and coverage with <a href="https://pittest.org">PIT</a>. * Mutation testing and coverage with <a href="https://pitest.org">PIT</a>.
* *
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0 * @since 1.0
*/ */
public class PitestOperation extends AbstractProcessOperation<PitestOperation> { public class PitestOperation extends AbstractProcessOperation<PitestOperation> {
/**
* False constant.
*/
protected static final String FALSE = "false"; protected static final String FALSE = "false";
/**
* Source directories command line option.
*/
protected static final String SOURCE_DIRS = "--sourceDirs"; protected static final String SOURCE_DIRS = "--sourceDirs";
/**
* True constant.
*/
protected static final String TRUE = "true"; protected static final String TRUE = "true";
private static final Logger LOGGER = Logger.getLogger(PitestOperation.class.getName()); private static final Logger LOGGER = Logger.getLogger(PitestOperation.class.getName());
/** /**
@ -150,32 +159,28 @@ public class PitestOperation extends AbstractProcessOperation<PitestOperation> {
/** /**
* Flag to indicate if PIT should attempt to detect the inlined code generated by the java compiler in order to * 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 * implement {@code finally} blocks. Each copy of the inlined code would normally be mutated separately, resulting
* multiple identical looking mutations. When inlined code detection is enabled PIT will attempt to spot inlined * 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. * code and create only a single mutation that mutates all affected instructions simultaneously.
* <p> * <p>
* The algorithm cannot easily distinguish between inlined copies of code, and genuine duplicate instructions on the same line within a finally block. * The algorithm cannot easily distinguish between inlined copies of code, and genuine duplicate instructions on
* the same line within a {@code finally} block.
* <p> * <p>
* In the case of any doubt PIT will act cautiously and assume that the code is not inlined. * In the case of any doubt PIT will act cautiously and assume that the code is not inlined.
* <p> * <p>
* This will be detected as two separate inlined instructions * This will be detected as two separate inlined instructions
* <p> * <pre>
* finally { * finally {
* <p> * int++;
* &nbsp;&nbsp;int++; * int++;
* <p>
* &nbsp;&nbsp;int++;
* <p>
* } * }
* <p> * </pre>
* But this will look confusing so PIT will assume no in-lining is taking place. * But this will look confusing so PIT will assume no in-lining is taking place.
* <p> * <pre>
* finally { * finally {
* <p>
* &nbsp;&nbsp;int++; int++; * &nbsp;&nbsp;int++; int++;
* </p>
* } * }
* <p> * </pre>
* This sort of pattern might not be common with integer addition, but things like string concatenation are likely * 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. * to produce multiple similar instructions on the same line.
* <p> * <p>
@ -347,8 +352,8 @@ public class PitestOperation extends AbstractProcessOperation<PitestOperation> {
/** /**
* List of features to enable/disable * List of features to enable/disable
* <p> *
* {@see #featrues(String) * @see #features(String...)
*/ */
public PitestOperation features(Collection<String> feature) { public PitestOperation features(Collection<String> feature) {
options.put("--features", String.join(",", feature)); options.put("--features", String.join(",", feature));
@ -357,8 +362,8 @@ public class PitestOperation extends AbstractProcessOperation<PitestOperation> {
/** /**
* List of features to enable/disable * List of features to enable/disable
* <p> *
* {@see #featrues(String) * @see #features(Collection)
*/ */
public PitestOperation features(String... feature) { public PitestOperation features(String... feature) {
options.put("--features", String.join(",", feature)); options.put("--features", String.join(",", feature));
@ -399,8 +404,8 @@ public class PitestOperation extends AbstractProcessOperation<PitestOperation> {
} }
/** /**
* list of TestNG groups/JUnit categories to include in mutation analysis. Note that only class level categories are * list of TestNG groups/JUnit categories to include in mutation analysis. Note that only class level categories
* supported. * are supported.
* *
* @see #includedGroups(Collection) * @see #includedGroups(Collection)
*/ */