+ +1 + | ++ + + + + + | +package com.example; |
+ +2 + | ++ + + + + + | +|
+ +3 + | ++ + + + + + | +public class ExamplesLib { |
+ +4 + | ++ + + + + + | + public String getMessage() { |
+ +5 + | +
+
+1
+
+1. getMessage : replaced return value with "" for com/example/ExamplesLib::getMessage → KILLED + + + + |
+ return "Hello World!"; |
+ +6 + | ++ + + + + + | + } |
+ +7 + | ++ + + + + + | +} |
Mutations | ||
5 | ++ |
+
+
+
+ 1.1 |
+
+ +1 + | ++ + + + + + | +package com.example; |
+ +2 + | ++ + + + + + | +|
+ +3 + | ++ + + + + + | +import org.junit.jupiter.api.Test; |
+ +4 + | ++ + + + + + | +|
+ +5 + | ++ + + + + + | +import static org.junit.jupiter.api.Assertions.assertEquals; |
+ +6 + | ++ + + + + + | +|
+ +7 + | ++ + + + + + | +public class ExamplesTest { |
+ +8 + | ++ + + + + + | + @Test |
+ +9 + | ++ + + + + + | + void verifyHello() { |
+ +10 + | +
+
+1
+
+1. verifyHello : removed call to org/junit/jupiter/api/Assertions::assertEquals → SURVIVED + + + + |
+ assertEquals("Hello World!", new ExamplesLib().getMessage()); |
+ +11 + | ++ + + + + + | + } |
+ +12 + | ++ + + + + + | +} |
Mutations | ||
10 | ++ |
+
+
+
+ 1.1 |
+
Number of Classes | +Line Coverage | +Mutation Coverage | +Test Strength | +
---|---|---|---|
2 | +100% | +50% | +50% | +
Name | +Line Coverage | +Mutation Coverage | +Test Strength | +
---|---|---|---|
ExamplesLib.java | +100% |
+ 100% |
+ 100% |
+
ExamplesTest.java | +100% |
+ 0% |
+ 0% |
+
Number of Classes | +Line Coverage | +Mutation Coverage | +Test Strength | +
---|---|---|---|
2 | +100% | +50% | +50% | +
Name | +Number of Classes | +Line Coverage | +Mutation Coverage | +Test Strength | +
---|---|---|---|---|
com.example | +2 | +100% |
+ 50% |
+ 50% |
+
* If the feature {@code FLOGCALL} is disabled, this parameter is ignored and logging calls are also mutated.
*
- * @param avoidCallsTo the list of packages
- * @return this operation instance
* @see #avoidCallsTo(String...)
*/
public PitestOperation avoidCallsTo(Collection
* If the feature {@code FLOGCALL} is disabled, this parameter is ignored and logging calls are also mutated.
*
- * @param avoidCallTo one or more packages
- * @return this operation instance
* @see #avoidCallsTo(Collection)
*/
public PitestOperation avoidCallsTo(String... avoidCallTo) {
- return avoidCallsTo(List.of(avoidCallTo));
- }
-
- private String buildClassPath(String... path) {
- var classpath = new StringBuilder();
- for (var p : path) {
- if (!p.isBlank()) {
- if (!classpath.isEmpty()) {
- classpath.append(File.pathSeparator);
- }
- classpath.append(p);
- }
- }
- return classpath.toString();
- }
-
- /**
- * 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.
- *
- * @param path one or more paths
- * @return this operation instance
- * @see #classPath(Collection)
- */
- public PitestOperation classPath(String... path) {
- return classPath(List.of(path));
- }
-
- /**
- * 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.
- *
- * @param path one or more paths
- * @return this operation instance
- * @see #classPathPaths(Collection)
- */
- public PitestOperation classPath(Path... path) {
- return classPathPaths(List.of(path));
- }
-
- /**
- * Additional classpath entries to use when looking for tests and mutable code.
- *
- * @param path the list of paths
- * @return this operation instance
- * @see #classPath(String...)
- */
- public PitestOperation classPath(Collection
* Defaults to {@code true}
- *
- * @param isDetectInlinedCode {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation detectInlinedCode(boolean isDetectInlinedCode) {
if (isDetectInlinedCode) {
- options_.put("--detectInlinedCode", TRUE);
+ options.put("--detectInlinedCode", TRUE);
} else {
- options_.put("--detectInlinedCode", FALSE);
- }
- return this;
- }
-
- /**
- * Whether to run in dry run mode.
- *
- * Defaults to {@code false}
- *
- * @param isDryRun {@code true} or {@code false}
- * @return this operation instance
- */
- public PitestOperation dryRun(boolean isDryRun) {
- if (isDryRun) {
- options_.put("--dryRun", TRUE);
- } else {
- options_.put("--dryRun", FALSE);
+ options.put("--detectInlinedCode", FALSE);
}
return this;
}
@@ -316,23 +198,20 @@ public class PitestOperation extends AbstractProcessOperation
* Defaults to {@code false}
- *
- * @param jsExport {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation exportLineCoverage(boolean jsExport) {
if (jsExport) {
- options_.put("--exportLineCoverage", TRUE);
+ options.put("--exportLineCoverage", TRUE);
} else {
- options_.put("--exportLineCoverage", FALSE);
+ options.put("--exportLineCoverage", FALSE);
}
return this;
}
@@ -503,15 +340,12 @@ public class PitestOperation extends AbstractProcessOperation
* Defaults to {@code true}
- *
- * @param isFail {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation failWhenNoMutations(boolean isFail) {
if (isFail) {
- options_.put("--failWhenNoMutations", TRUE);
+ options.put("--failWhenNoMutations", TRUE);
} else {
- options_.put("--failWhenNoMutations", FALSE);
+ options.put("--failWhenNoMutations", FALSE);
}
return this;
}
@@ -519,125 +353,52 @@ public class PitestOperation extends AbstractProcessOperation
* Defaults to {@code true}
- *
- * @param isLaunchClasspath {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation includeLaunchClasspath(boolean isLaunchClasspath) {
if (isLaunchClasspath) {
- options_.put("--includeLaunchClasspath", TRUE);
+ options.put("--includeLaunchClasspath", TRUE);
} else {
- options_.put("--includeLaunchClasspath", FALSE);
+ options.put("--includeLaunchClasspath", FALSE);
}
return this;
}
@@ -646,148 +407,52 @@ public class PitestOperation extends AbstractProcessOperation
- * Default is {@code UTF-8}.
- *
- * @param encoding the encoding
- * @return this operation instance
- */
- public PitestOperation inputEncoding(String encoding) {
- if (isNotBlank(encoding)) {
- options_.put("--inputEncoding", encoding);
- }
- return this;
- }
-
- /*
- * Determines if a string is not blank.
- */
- private boolean isNotBlank(String s) {
- return s != null && !s.isBlank();
- }
-
- private String joinClasspathJar(List
* PIT will always attempt not to mutate test classes even if they are defined on a mutable path.
*
- * @param path one or one paths
- * @return this operation instance
* @see #mutableCodePaths(Collection)
*/
public PitestOperation mutableCodePaths(String... path) {
- return mutableCodePaths(List.of(path));
- }
-
- /**
- * 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.
- *
- * @param path one or one paths
- * @return this operation instance
- * @see #mutableCodePathsPaths(Collection)
- */
- public PitestOperation mutableCodePaths(Path... path) {
- return mutableCodePathsPaths(List.of(path));
- }
-
- /**
- * 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.
- *
- * @param path one or one paths
- * @return this operation instance
- * @see #mutableCodePathsFiles(Collection)
- */
- public PitestOperation mutableCodePaths(File... path) {
- return mutableCodePathsFiles(List.of(path));
- }
-
- /**
- * 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.
- *
- * @param paths the list of paths
- * @return this operation instance
- * @see #mutableCodePaths(String...)
- */
- public PitestOperation mutableCodePaths(Collection
* PIT will always attempt not to mutate test classes even if they are defined on a mutable path.
*
- * @param paths the list of paths
- * @return this operation instance
- * @see #mutableCodePaths(File...)
+ * @see #mutableCodePaths(String...)
*/
- public PitestOperation mutableCodePathsFiles(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.
- *
- * @param paths the list of paths
- * @return this operation instance
- * @see #mutableCodePaths(Path...)
- */
- public PitestOperation mutableCodePathsPaths(Collection
- * Defaults to {@code gregor}
- *
- * @param engine the engine
- * @return this operation instance
- */
- public PitestOperation mutationEngine(String engine) {
- options_.put("--mutationEngine", engine);
+ 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.
- *
- * @param threshold the threshold
- * @return this operation instance
*/
public PitestOperation mutationThreshold(int threshold) {
if (threshold >= 0 && threshold <= 100) {
- options_.put("--mutationThreshold", String.valueOf(threshold));
+ options.put("--mutationThreshold", String.valueOf(threshold));
}
return this;
}
- /**
- * Maximum number of mutations to include.
- *
- * @param size the size
- * @return this operation instance
- */
- public PitestOperation mutationUnitSize(int size) {
- options_.put("--mutationUnitSize", String.valueOf(size));
- return this;
- }
-
/**
* List of mutation operators.
*
- * @param mutator one or more mutators
- * @return this operation instance
* @see #mutators(Collection)
*/
public PitestOperation mutators(String... mutator) {
- options_.put("--mutators", String.join(",", Arrays.stream(mutator).filter(this::isNotBlank).toList()));
+ options.put("--mutators", String.join(",", mutator));
return this;
}
/**
* List of mutation operators.
*
- * @param mutators the list of mutators
- * @return this operation instance
* @see #mutators(String...)
*/
public PitestOperation mutators(Collection
* Default is {@code UTF-8}.
- *
- * @param encoding the encoding
- * @return this operation instance
*/
public PitestOperation outputEncoding(String encoding) {
- if (isNotBlank(encoding)) {
- options_.put("--outputEncoding", encoding);
- }
+ options.put("--outputEncoding", encoding);
return this;
}
/**
- * A list of formats in which to write mutation results as the mutations are analysed.
+ * 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}.
*
- * @param outputFormat one or more output formats
- * @return this operation instance
- * @see #outputFormatsFiles(Collection)
- */
- public PitestOperation outputFormats(File... outputFormat) {
- return outputFormatsFiles(List.of(outputFormat));
- }
-
- /**
- * A 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}.
- *
- * @param outputFormat one or more output formats
- * @return this operation instance
- * @see #outputFormatsPaths(Collection)
- */
- public PitestOperation outputFormats(Path... outputFormat) {
- return outputFormatsPaths(List.of(outputFormat));
- }
-
- /**
- * A 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}.
- *
- * @param outputFormat one or more output formats
- * @return this operation instance
* @see #outputFormats(Collection)
*/
public PitestOperation outputFormats(String... outputFormat) {
- return outputFormats(List.of(outputFormat));
+ options.put("--outputFormats", String.join(",", outputFormat));
+ return this;
}
/**
- * A list of formats in which to write mutation results as the mutations are analysed.
+ * 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}.
*
- * @param outputFormats the list of output formats
- * @return this operation instance
* @see #outputFormats(String...)
*/
public PitestOperation outputFormats(Collection
- * Defaults to {@code HTML}.
- *
- * @param outputFormats the list of output formats
- * @return this operation instance
- * @see #outputFormats(File...)
- */
- public PitestOperation outputFormatsFiles(Collection
- * Defaults to {@code HTML}.
- *
- * @param outputFormats the list of output formats
- * @return this operation instance
- * @see #outputFormats(Path...)
- */
- public PitestOperation outputFormatsPaths(Collection
* Default is {@code false}
- *
- * @param isSkipFail {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation skipFailingTests(boolean isSkipFail) {
if (isSkipFail) {
- options_.put("--skipFailingTests", TRUE);
+ options.put("--skipFailingTests", TRUE);
} else {
- options_.put("--skipFailingTests", FALSE);
+ options.put("--skipFailingTests", FALSE);
}
return this;
}
@@ -1172,71 +585,23 @@ public class PitestOperation extends AbstractProcessOperation
@@ -1246,12 +611,10 @@ public class PitestOperation extends AbstractProcessOperation
- * This parameter can be used to point PIT to a top level suite or suites. Custom suites such as
- * ClassPathSuite are supported.
- *
- * @param test one or more tests
- * @return this operation instance
- * @see #targetTests(Collection)
- */
- public PitestOperation targetTests(String... test) {
- return targetTests(List.of(test));
- }
-
- /**
- * A 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.
- *
- * @param tests the list of tests
- * @return this operation instance
- * @see #targetTests(String...)
- */
- public PitestOperation targetTests(Collection
+ * This parameter can be used to point PIT to a top level suite or suites. Custom suites such as
+ * ClassPathSuite are supported.
*
- * @param threshold the threshold
- * @return this operation instance
+ * @see #targetTests(Collection)
*/
- public PitestOperation testStrengthThreshold(int threshold) {
- options_.put("--testStrengthThreshold", String.valueOf(threshold));
+ 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}
- *
- * @param factor the factor amount
- * @return this operation instance
*/
public PitestOperation timeoutConst(int factor) {
- options_.put("--timeoutConst", String.valueOf(factor));
+ options.put("--timeoutConst", String.valueOf(factor));
return this;
}
@@ -1345,29 +687,23 @@ public class PitestOperation extends AbstractProcessOperation
* Defaults to {@code 1.25}
- *
- * @param factor the factor
- * @return this operation instance
*/
public PitestOperation timeoutFactor(double factor) {
- options_.put("--timeoutFactor", String.valueOf(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
+ * 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}
- *
- * @param isTimestamped {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation timestampedReports(boolean isTimestamped) {
if (isTimestamped) {
- options_.put("--timestampedReports", TRUE);
+ options.put("--timestampedReports", TRUE);
} else {
- options_.put("--timestampedReports", FALSE);
+ options.put("--timestampedReports", FALSE);
}
return this;
}
@@ -1376,15 +712,12 @@ public class PitestOperation extends AbstractProcessOperation
* Defaults to {@code false}
- *
- * @param isUseClasspathJar {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation useClasspathJar(boolean isUseClasspathJar) {
if (isUseClasspathJar) {
- options_.put("--useClasspathJar", TRUE);
+ options.put("--useClasspathJar", TRUE);
} else {
- options_.put("--useClasspathJar", FALSE);
+ options.put("--useClasspathJar", FALSE);
}
return this;
}
@@ -1393,29 +726,13 @@ public class PitestOperation extends AbstractProcessOperation
* Defaults to {@code false}
- *
- * @param isVerbose {@code true} or {@code false}
- * @return this operation instance
*/
public PitestOperation verbose(boolean isVerbose) {
if (isVerbose) {
- options_.put("--verbose", TRUE);
+ options.put("--verbose", TRUE);
} else {
- options_.put("--verbose", FALSE);
+ options.put("--verbose", FALSE);
}
return this;
}
-
- /**
- * The verbosity of output.
- *
- * Defaults to {@code DEFAULT}
- *
- * @param verbosity the verbosity
- * @return this operation instance
- */
- public PitestOperation verbosity(String verbosity) {
- options_.put("--verbosity", verbosity);
- return this;
- }
-}
+}
\ No newline at end of file
diff --git a/src/test/java/rife/bld/extension/PitestOperationTest.java b/src/test/java/rife/bld/extension/PitestOperationTest.java
index bb5ed8c..70d5ef8 100644
--- a/src/test/java/rife/bld/extension/PitestOperationTest.java
+++ b/src/test/java/rife/bld/extension/PitestOperationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2025 the original author or authors.
+ * 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.
@@ -16,40 +16,32 @@
package rife.bld.extension;
-import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledOnOs;
-import org.junit.jupiter.api.condition.OS;
import rife.bld.BaseProject;
import rife.bld.Project;
import rife.bld.WebProject;
-import rife.bld.operations.exceptions.ExitStatusException;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-import java.nio.file.Paths;
import java.util.List;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
-import static rife.bld.extension.PitestOperation.FALSE;
-import static rife.bld.extension.PitestOperation.TRUE;
+import static rife.bld.extension.PitestOperation.*;
-@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class PitestOperationTest {
private static final String AS_LIST = "as list";
- private static final String BAR = "bar";
- private static final String FOO = "foo";
- private static final String FOOBAR = FOO + ',' + BAR;
+ 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);
+ assertThat(op.options.get("--argLine")).isEqualTo(FOO);
}
@Test
@@ -57,87 +49,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.avoidCallsTo(FOO, BAR);
- assertThat(op.options().get("--avoidCallsTo")).isEqualTo(FOOBAR);
+ 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
- @EnabledOnOs(OS.LINUX)
- void checkAllParameters() throws IOException {
- var args = Files.readAllLines(Paths.get("src", "test", "resources", "pitest-args.txt"));
-
- assertThat(args).isNotEmpty();
-
- var params = new PitestOperation()
- .fromProject(new BaseProject())
- .argLine(FOO)
- .avoidCallsTo(FOO, BAR)
- .classPath(FOO, BAR)
- .classPathFile(FOO)
- .coverageThreshold(0)
- .detectInlinedCode(false)
- .dryRun(false)
- .excludedClasses("class")
- .excludedClasses(List.of(FOO, BAR))
- .excludedGroups("group")
- .excludedGroups(List.of(FOO, BAR))
- .excludedMethods("method")
- .excludedMethods(List.of(FOO, BAR))
- .excludedRunners("runners")
- .excludedTestClasses("test")
- .exportLineCoverage(true)
- .failWhenNoMutations(true)
- .features("feature")
- .fullMutationMatrix(true)
- .historyInputLocation("inputLocation")
- .historyOutputLocation("outputLocation")
- .includeLaunchClasspath(true)
- .includedGroups("group")
- .includedTestMethods("method")
- .inputEncoding("encoding")
- .jvmArgs("-XX:+UnlogregckDiagnosticVMOptions")
- .jvmPath("path")
- .maxMutationsPerClass(3)
- .maxSurviving(1)
- .mutableCodePaths("codePaths")
- .mutationEngine("engine")
- .mutationThreshold(0)
- .mutationUnitSize(1)
- .mutators(List.of(FOO, BAR))
- .outputEncoding("encoding")
- .outputFormats("json")
- .pluginConfiguration("key", "value")
- .projectBase("base")
- .reportDir("dir")
- .skipFailingTests(true)
- .targetClasses("class")
- .targetTests("test")
- .testStrengthThreshold(0)
- .threads(0)
- .timeoutConst(0)
- .timeoutFactor(0)
- .timestampedReports(true)
- .useClasspathJar(true)
- .verbose(true)
- .verbosity("default")
- .executeConstructProcessCommandList();
-
- try (var softly = new AutoCloseableSoftAssertions()) {
- for (var p : args) {
- var found = false;
- for (var a : params) {
- if (a.startsWith(p)) {
- found = true;
- break;
- }
- }
- softly.assertThat(found).as(p + " not found.").isTrue();
- }
- }
+ assertThat(op.options.get("--avoidCallsTo")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -145,12 +62,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.classPath(FOO, BAR);
- assertThat(op.options().get("--classPath")).isEqualTo(FOOBAR);
+ 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);
+ assertThat(op.options.get("--classPath")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -158,7 +75,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.classPathFile(FOO);
- assertThat(op.options().get("--classPathFile")).isEqualTo(FOO);
+ assertThat(op.options.get("--classPathFile")).isEqualTo(FOO);
}
@Test
@@ -166,12 +83,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.coverageThreshold(3);
- assertThat(op.options().get("--coverageThreshold")).isEqualTo("3");
+ assertThat(op.options.get("--coverageThreshold")).isEqualTo("3");
op = new PitestOperation()
.fromProject(new BaseProject())
.coverageThreshold(101);
- assertThat(op.options().get("--coverageThreshold")).isNull();
+ assertThat(op.options.get("--coverageThreshold")).isNull();
}
@Test
@@ -179,12 +96,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.detectInlinedCode(true);
- assertThat(op.options().get("--detectInlinedCode")).isEqualTo(TRUE);
+ assertThat(op.options.get("--detectInlinedCode")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.detectInlinedCode(false);
- assertThat(op.options().get("--detectInlinedCode")).isEqualTo(FALSE);
+ assertThat(op.options.get("--detectInlinedCode")).isEqualTo(FALSE);
}
@Test
@@ -192,12 +109,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedClasses(FOO, BAR);
- assertThat(op.options().get("--excludedClasses")).isEqualTo(FOOBAR);
+ assertThat(op.options.get("--excludedClasses")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.excludedClasses(Set.of(FOO, BAR));
- assertThat(op.options().get("--excludedClasses")).as("as set").contains(FOO).contains(BAR).contains(",");
+ assertThat(op.options.get("--excludedClasses")).as("as set").contains(FOO).contains(BAR).contains(",");
}
@Test
@@ -205,12 +122,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedGroups(FOO, BAR);
- assertThat(op.options().get("--excludedGroups")).isEqualTo(FOOBAR);
+ 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);
+ assertThat(op.options.get("--excludedGroups")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -218,38 +135,30 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.excludedMethods(FOO, BAR);
- assertThat(op.options().get("--excludedMethods")).isEqualTo(FOOBAR);
+ 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 excludedRunners() {
- var op = new PitestOperation()
- .fromProject(new BaseProject())
- .excludedRunners(FOO);
- assertThat(op.options().get("--excludedRunners")).isEqualTo(FOO);
+ assertThat(op.options.get("--excludedMethods")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
void excludedTests() {
var op = new PitestOperation()
.fromProject(new BaseProject())
- .excludedTestClasses(FOO, BAR);
- assertThat(op.options().get("--excludedTestClasses")).isEqualTo(FOOBAR);
+ .excludedTests(FOO, BAR);
+ assertThat(op.options.get("--excludedTests")).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
- .excludedTestClasses(List.of(FOO, BAR));
- assertThat(op.options().get("--excludedTestClasses")).as("as list").isEqualTo(FOOBAR);
+ .excludedTests(List.of(FOO, BAR));
+ assertThat(op.options.get("--excludedTests")).as("as list").isEqualTo(FOOBAR);
}
@Test
void execute() throws IOException {
- var tmpDir = Files.createTempDirectory("bld-pitest-");
+ var tmpDir = Files.createTempDirectory("bld-pitest");
tmpDir.toFile().deleteOnExit();
var op = new PitestOperation().
fromProject(new WebProject())
@@ -298,23 +207,17 @@ class PitestOperationTest {
"--sourceDirs c:\\myProject\\src");
}
- @Test
- void executeNoProject() {
- var op = new PitestOperation();
- assertThatCode(op::execute).isInstanceOf(ExitStatusException.class);
- }
-
@Test
void exportLineCoverage() {
var op = new PitestOperation()
.fromProject(new BaseProject())
.exportLineCoverage(true);
- assertThat(op.options().get("--exportLineCoverage")).isEqualTo(TRUE);
+ assertThat(op.options.get("--exportLineCoverage")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.exportLineCoverage(false);
- assertThat(op.options().get("--exportLineCoverage")).isEqualTo(FALSE);
+ assertThat(op.options.get("--exportLineCoverage")).isEqualTo(FALSE);
}
@Test
@@ -322,12 +225,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.failWhenNoMutations(true);
- assertThat(op.options().get("--failWhenNoMutations")).isEqualTo(TRUE);
+ assertThat(op.options.get("--failWhenNoMutations")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.failWhenNoMutations(false);
- assertThat(op.options().get("--failWhenNoMutations")).isEqualTo(FALSE);
+ assertThat(op.options.get("--failWhenNoMutations")).isEqualTo(FALSE);
}
@Test
@@ -335,20 +238,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.features(FOO, BAR);
- assertThat(op.options().get("--features")).isEqualTo(FOOBAR);
+ 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 fullMutationMatrix() {
- var op = new PitestOperation()
- .fromProject(new BaseProject())
- .fullMutationMatrix(true);
- assertThat(op.options().get("--fullMutationMatrix")).isEqualTo(TRUE);
+ assertThat(op.options.get("--features")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -356,7 +251,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.historyInputLocation(FOO);
- assertThat(op.options().get("--historyInputLocation")).isEqualTo(FOO);
+ assertThat(op.options.get("--historyInputLocation")).isEqualTo(FOO);
}
@Test
@@ -364,7 +259,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.historyOutputLocation(FOO);
- assertThat(op.options().get("--historyOutputLocation")).isEqualTo(FOO);
+ assertThat(op.options.get("--historyOutputLocation")).isEqualTo(FOO);
}
@Test
@@ -372,12 +267,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.includeLaunchClasspath(true);
- assertThat(op.options().get("--includeLaunchClasspath")).isEqualTo(TRUE);
+ assertThat(op.options.get("--includeLaunchClasspath")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.includeLaunchClasspath(false);
- assertThat(op.options().get("--includeLaunchClasspath")).isEqualTo(FALSE);
+ assertThat(op.options.get("--includeLaunchClasspath")).isEqualTo(FALSE);
}
@Test
@@ -385,28 +280,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.includedGroups(FOO, BAR);
- assertThat(op.options().get("--includedGroups")).isEqualTo(FOOBAR);
+ 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 includedTestMethods() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .includedTestMethods(FOO);
- assertThat(op.options().get("--includedTestMethods")).isEqualTo(FOO);
- }
-
- @Test
- void inputEncoding() {
- var op = new PitestOperation()
- .fromProject(new BaseProject())
- .inputEncoding(FOO);
- assertThat(op.options().get("--inputEncoding")).isEqualTo(FOO);
+ assertThat(op.options.get("--includedGroups")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -414,12 +293,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.jvmArgs(FOO, BAR);
- assertThat(op.options().get("--jvmArgs")).isEqualTo(FOOBAR);
+ 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);
+ assertThat(op.options.get("--jvmArgs")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -427,23 +306,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.jvmPath(FOO);
- assertThat(op.options().get("--jvmPath")).isEqualTo(FOO);
- }
-
- @Test
- void maxMutationsPerClass() {
- var op = new PitestOperation()
- .fromProject(new BaseProject())
- .maxMutationsPerClass(12);
- assertThat(op.options().get("--maxMutationsPerClass")).isEqualTo("12");
- }
-
- @Test
- void maxSurviving() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .maxSurviving(1);
- assertThat(op.options().get("--maxSurviving")).isEqualTo("1");
+ assertThat(op.options.get("--jvmPath")).isEqualTo(FOO);
}
@Test
@@ -451,20 +314,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.mutableCodePaths(FOO, BAR);
- assertThat(op.options().get("--mutableCodePaths")).isEqualTo(FOOBAR);
+ 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 mutationEngine() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .mutationEngine(FOO);
- assertThat(op.options().get("--mutationEngine")).isEqualTo(FOO);
+ assertThat(op.options.get("--mutableCodePaths")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -472,20 +327,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.mutationThreshold(3);
- assertThat(op.options().get("--mutationThreshold")).isEqualTo("3");
+ assertThat(op.options.get("--mutationThreshold")).isEqualTo("3");
op = new PitestOperation()
.fromProject(new BaseProject())
.mutationThreshold(101);
- assertThat(op.options().get("--mutationThreshold")).isNull();
- }
-
- @Test
- void mutationUnitSize() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .mutationUnitSize(2);
- assertThat(op.options().get("--mutationUnitSize")).isEqualTo("2");
+ assertThat(op.options.get("--mutationThreshold")).isNull();
}
@Test
@@ -493,12 +340,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.mutators(FOO, BAR);
- assertThat(op.options().get("--mutators")).isEqualTo(FOOBAR);
+ 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);
+ assertThat(op.options.get("--mutators")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -506,7 +353,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.outputEncoding(FOO);
- assertThat(op.options().get("--outputEncoding")).isEqualTo(FOO);
+ assertThat(op.options.get("--outputEncoding")).isEqualTo(FOO);
}
@Test
@@ -514,28 +361,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.outputFormats(FOO, BAR);
- assertThat(op.options().get("--outputFormats")).isEqualTo(FOOBAR);
+ 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 pluginConfiguration() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .pluginConfiguration(FOO, BAR);
- assertThat(op.options().get("--pluginConfiguration")).isEqualTo(FOO + "=" + BAR);
- }
-
- @Test
- void projectBase() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .projectBase(FOO);
- assertThat(op.options().get("--projectBase")).isEqualTo(FOO);
+ assertThat(op.options.get("--outputFormats")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -543,7 +374,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.reportDir(FOO);
- assertThat(op.options().get("--reportDir")).isEqualTo(FOO);
+ assertThat(op.options.get("--reportDir")).isEqualTo(FOO);
}
@Test
@@ -551,12 +382,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.skipFailingTests(true);
- assertThat(op.options().get("--skipFailingTests")).isEqualTo(TRUE);
+ assertThat(op.options.get("--skipFailingTests")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.skipFailingTests(false);
- assertThat(op.options().get("--skipFailingTests")).isEqualTo(FALSE);
+ assertThat(op.options.get("--skipFailingTests")).isEqualTo(FALSE);
}
@Test
@@ -564,12 +395,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.sourceDirs(FOO, BAR);
- assertThat(op.options().get("--sourceDirs")).isEqualTo(FOOBAR);
+ assertThat(op.options.get(SOURCE_DIRS)).isEqualTo(FOOBAR);
op = new PitestOperation()
.fromProject(new Project())
.sourceDirs(List.of(FOO, BAR));
- assertThat(op.options().get("--sourceDirs")).as(AS_LIST).isEqualTo(FOOBAR);
+ assertThat(op.options.get(SOURCE_DIRS)).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -577,12 +408,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.targetClasses(FOO, BAR);
- assertThat(op.options().get("--targetClasses")).isEqualTo(FOOBAR);
+ 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);
+ assertThat(op.options.get("--targetClasses")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -590,189 +421,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.targetTests(FOO, BAR);
- assertThat(op.options().get("--targetTests")).isEqualTo(FOOBAR);
+ 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 testClassPath() {
- var foo = new File(FOO);
- var bar = new File(BAR);
-
- var foobar = String.format("%s,%s", FOO, BAR);
- var op = new PitestOperation().classPath(FOO, BAR);
- assertThat(op.options().get("--classPath")).as("String...").isEqualTo(foobar);
-
- op = new PitestOperation().classPath(List.of(FOO, BAR));
- assertThat(op.options().get("--classPath")).as("List(String...)").isEqualTo(foobar);
-
- foobar = String.format("%s,%s", foo.getAbsolutePath(), bar.getAbsolutePath());
- op = new PitestOperation().classPath(foo, bar);
- assertThat(op.options().get("--classPath")).as("File...").isEqualTo(foobar);
-
- op = new PitestOperation().classPathFiles(List.of(foo, bar));
- assertThat(op.options().get("--classPath")).as("List(String...)").isEqualTo(foobar);
-
- op = new PitestOperation().classPath(foo.toPath(), bar.toPath());
- assertThat(op.options().get("--classPath")).as("Path...").isEqualTo(foobar);
-
- op = new PitestOperation().classPathPaths(List.of(foo.toPath(), bar.toPath()));
- assertThat(op.options().get("--classPath")).as("List(Path...)").isEqualTo(foobar);
- }
-
- @Test
- void testHistoryInputLocation() {
- var foo = new File(FOO);
- var op = new PitestOperation().historyInputLocation(FOO);
- assertThat(op.options().get("--historyInputLocation")).as("as string").isEqualTo(FOO);
-
- op = new PitestOperation().historyInputLocation(foo);
- assertThat(op.options().get("--historyInputLocation")).as("as file").isEqualTo(foo.getAbsolutePath());
-
- op = new PitestOperation().historyInputLocation(foo.toPath());
- assertThat(op.options().get("--historyInputLocation")).as("as path").isEqualTo(foo.getAbsolutePath());
- }
-
- @Test
- void testHistoryOutputLocation() {
- var foo = new File(FOO);
- var op = new PitestOperation().historyOutputLocation(FOO);
- assertThat(op.options().get("--historyOutputLocation")).as("as string").isEqualTo(FOO);
-
- op = new PitestOperation().historyOutputLocation(foo);
- assertThat(op.options().get("--historyOutputLocation")).as("as file").isEqualTo(foo.getAbsolutePath());
-
- op = new PitestOperation().historyOutputLocation(foo.toPath());
- assertThat(op.options().get("--historyOutputLocation")).as("as path").isEqualTo(foo.getAbsolutePath());
- }
-
- @Test
- void testJvmPath() {
- var foo = new File(FOO);
- var op = new PitestOperation().jvmPath(FOO);
- assertThat(op.options().get("--jvmPath")).as("as string").isEqualTo(FOO);
-
- op = new PitestOperation().jvmPath(foo);
- assertThat(op.options().get("--jvmPath")).as("as file").isEqualTo(foo.getAbsolutePath());
-
- op = new PitestOperation().jvmPath(foo.toPath());
- assertThat(op.options().get("--jvmPath")).as("as path").isEqualTo(foo.getAbsolutePath());
- }
-
- @Test
- void testMutableCodePaths() {
- var foo = new File(FOO);
- var bar = new File(BAR);
-
- var foobar = String.format("%s,%s", FOO, BAR);
- var op = new PitestOperation().mutableCodePaths(FOO, BAR);
- assertThat(op.options().get("--mutableCodePaths")).as("String...").isEqualTo(foobar);
-
- op = new PitestOperation().mutableCodePaths(List.of(FOO, BAR));
- assertThat(op.options().get("--mutableCodePaths")).as("List(String...)").isEqualTo(foobar);
-
- foobar = String.format("%s,%s", foo.getAbsolutePath(), bar.getAbsolutePath());
- op = new PitestOperation().mutableCodePaths(foo, bar);
- assertThat(op.options().get("--mutableCodePaths")).as("File...").isEqualTo(foobar);
-
- op = new PitestOperation().mutableCodePathsFiles(List.of(foo, bar));
- assertThat(op.options().get("--mutableCodePaths")).as("List(String...)").isEqualTo(foobar);
-
- op = new PitestOperation().mutableCodePaths(foo.toPath(), bar.toPath());
- assertThat(op.options().get("--mutableCodePaths")).as("Path...").isEqualTo(foobar);
-
- op = new PitestOperation().mutableCodePathsPaths(List.of(foo.toPath(), bar.toPath()));
- assertThat(op.options().get("--mutableCodePaths")).as("List(Path...)").isEqualTo(foobar);
- }
-
- @Test
- void testOutputFormats() {
- var foo = new File(FOO);
- var bar = new File(BAR);
-
- var foobar = String.format("%s,%s", FOO, BAR);
- var op = new PitestOperation().outputFormats(FOO, BAR);
- assertThat(op.options().get("--outputFormats")).as("String...").isEqualTo(foobar);
-
- op = new PitestOperation().outputFormats(List.of(FOO, BAR));
- assertThat(op.options().get("--outputFormats")).as("List(String...)").isEqualTo(foobar);
-
- foobar = String.format("%s,%s", foo.getAbsolutePath(), bar.getAbsolutePath());
- op = new PitestOperation().outputFormats(foo, bar);
- assertThat(op.options().get("--outputFormats")).as("File...").isEqualTo(foobar);
-
- op = new PitestOperation().outputFormatsFiles(List.of(foo, bar));
- assertThat(op.options().get("--outputFormats")).as("List(String...)").isEqualTo(foobar);
-
- op = new PitestOperation().outputFormats(foo.toPath(), bar.toPath());
- assertThat(op.options().get("--outputFormats")).as("Path...").isEqualTo(foobar);
-
- op = new PitestOperation().outputFormatsPaths(List.of(foo.toPath(), bar.toPath()));
- assertThat(op.options().get("--outputFormats")).as("List(Path...)").isEqualTo(foobar);
- }
-
- @Test
- void testProjectBase() {
- var foo = new File(FOO);
- var op = new PitestOperation().projectBase(FOO);
- assertThat(op.options().get("--projectBase")).as("as string").isEqualTo(FOO);
-
- op = new PitestOperation().projectBase(foo);
- assertThat(op.options().get("--projectBase")).as("as file").isEqualTo(foo.getAbsolutePath());
-
- op = new PitestOperation().projectBase(foo.toPath());
- assertThat(op.options().get("--projectBase")).as("as path").isEqualTo(foo.getAbsolutePath());
- }
-
- @Test
- void testReportDir() {
- var foo = new File(FOO);
- var op = new PitestOperation().reportDir(FOO);
- assertThat(op.options().get("--reportDir")).as("as string").isEqualTo(FOO);
-
- op = new PitestOperation().reportDir(foo);
- assertThat(op.options().get("--reportDir")).as("as file").isEqualTo(foo.getAbsolutePath());
-
- op = new PitestOperation().reportDir(foo.toPath());
- assertThat(op.options().get("--reportDir")).as("as path").isEqualTo(foo.getAbsolutePath());
- }
-
- @Test
- void testSourceDirs() {
- var foo = new File(FOO);
- var bar = new File(BAR);
-
- var foobar = String.format("%s,%s", FOO, BAR);
- var op = new PitestOperation().sourceDirs(FOO, BAR);
- assertThat(op.options().get("--sourceDirs")).as("String...").isEqualTo(foobar);
-
- op = new PitestOperation().sourceDirs(List.of(FOO, BAR));
- assertThat(op.options().get("--sourceDirs")).as("List(String...)").isEqualTo(foobar);
-
- foobar = String.format("%s,%s", foo.getAbsolutePath(), bar.getAbsolutePath());
- op = new PitestOperation().sourceDirs(foo, bar);
- assertThat(op.options().get("--sourceDirs")).as("File...").isEqualTo(foobar);
-
- op = new PitestOperation().sourceDirsFiles(List.of(foo, bar));
- assertThat(op.options().get("--sourceDirs")).as("List(String...)").isEqualTo(foobar);
-
- op = new PitestOperation().sourceDirs(foo.toPath(), bar.toPath());
- assertThat(op.options().get("--sourceDirs")).as("Path...").isEqualTo(foobar);
-
- op = new PitestOperation().sourceDirsPaths(List.of(foo.toPath(), bar.toPath()));
- assertThat(op.options().get("--sourceDirs")).as("List(Path...)").isEqualTo(foobar);
- }
-
- @Test
- void testStrengthThreshold() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .testStrengthThreshold(6);
- assertThat(op.options().get("--testStrengthThreshold")).isEqualTo("6");
+ assertThat(op.options.get("--targetTests")).as(AS_LIST).isEqualTo(FOOBAR);
}
@Test
@@ -780,7 +434,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.threads(3);
- assertThat(op.options().get("--threads")).isEqualTo("3");
+ assertThat(op.options.get("--threads")).isEqualTo("3");
}
@Test
@@ -788,7 +442,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.timeoutConst(300);
- assertThat(op.options().get("--timeoutConst")).isEqualTo("300");
+ assertThat(op.options.get("--timeoutConst")).isEqualTo("300");
}
@Test
@@ -796,7 +450,7 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.timeoutFactor(5.25);
- assertThat(op.options().get("--timeoutFactor")).isEqualTo("5.25");
+ assertThat(op.options.get("--timeoutFactor")).isEqualTo("5.25");
}
@Test
@@ -804,12 +458,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.timestampedReports(true);
- assertThat(op.options().get("--timestampedReports")).isEqualTo(TRUE);
+ assertThat(op.options.get("--timestampedReports")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.timestampedReports(false);
- assertThat(op.options().get("--timestampedReports")).isEqualTo(FALSE);
+ assertThat(op.options.get("--timestampedReports")).isEqualTo(FALSE);
}
@Test
@@ -817,12 +471,12 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.useClasspathJar(true);
- assertThat(op.options().get("--useClasspathJar")).isEqualTo(TRUE);
+ assertThat(op.options.get("--useClasspathJar")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.useClasspathJar(false);
- assertThat(op.options().get("--useClasspathJar")).isEqualTo(FALSE);
+ assertThat(op.options.get("--useClasspathJar")).isEqualTo(FALSE);
}
@Test
@@ -830,19 +484,11 @@ class PitestOperationTest {
var op = new PitestOperation()
.fromProject(new BaseProject())
.verbose(true);
- assertThat(op.options().get("--verbose")).isEqualTo(TRUE);
+ assertThat(op.options.get("--verbose")).isEqualTo(TRUE);
op = new PitestOperation()
.fromProject(new Project())
.verbose(false);
- assertThat(op.options().get("--verbose")).isEqualTo(FALSE);
+ assertThat(op.options.get("--verbose")).isEqualTo(FALSE);
}
-
- @Test
- void verbosity() {
- var op = new PitestOperation()
- .fromProject(new Project())
- .verbosity(FOO);
- assertThat(op.options().get("--verbosity")).isEqualTo(FOO);
- }
-}
+}
\ No newline at end of file
diff --git a/src/test/resources/pitest-args.txt b/src/test/resources/pitest-args.txt
deleted file mode 100644
index df24bfb..0000000
--- a/src/test/resources/pitest-args.txt
+++ /dev/null
@@ -1,48 +0,0 @@
---argLine
---avoidCallsTo
---classPath
---classPathFile
---coverageThreshold
---detectInlinedCode
---dryRun
---excludedClasses
---excludedGroups
---excludedMethods
---excludedRunners
---excludedTestClasses
---exportLineCoverage
---failWhenNoMutations
---features
---fullMutationMatrix
---historyInputLocation
---historyOutputLocation
---includedGroups
---includedTestMethods
---includeLaunchClasspath
---inputEncoding
---jvmArgs
---jvmPath
---maxMutationsPerClass
---maxSurviving
---mutableCodePaths
---mutationEngine
---mutationThreshold
---mutationUnitSize
---mutators
---outputEncoding
---outputFormats
---pluginConfiguration
---projectBase
---reportDir
---skipFailingTests
---sourceDirs
---targetClasses
---targetTests
---testStrengthThreshold
---threads
---timeoutConst
---timeoutFactor
---timestampedReports
---useClasspathJar
---verbose
---verbosity
- *
- *
- *
- *