Skip to content

Commit

Permalink
Fixed missing maxMutationsPerClass parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed May 27, 2024
1 parent ec0998c commit e7ed7ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/main/java/rife/bld/extension/PitestOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,17 @@ public PitestOperation jvmPath(String path) {
return this;
}

/**
* Maximum number of surviving mutants to allow without throwing an error.
*
* @param maxMutationsPerClass the max number
* @return this operation instance
*/
public PitestOperation maxMutationsPerClass(int maxMutationsPerClass) {
options.put("--maxMutationsPerClass", String.valueOf(maxMutationsPerClass));
return this;
}

/**
* Maximum number of surviving mutants to allow without throwing an error.
*
Expand Down
14 changes: 12 additions & 2 deletions src/test/java/rife/bld/extension/PitestOperationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ void checkAllParameters() {
"--fullMutationMatrix",
"--historyInputLocation",
"--historyOutputLocation",
"--includeLaunchClasspath",
"--includedGroups",
"--includedTestMethods",
"--includeLaunchClasspath",
"--inputEncoding",
"--jvmArgs",
"--jvmPath",
"--maxMutationsPerClass",
"--maxSurviving",
"--mutableCodePaths",
"--mutationEngine",
Expand Down Expand Up @@ -122,8 +123,8 @@ void checkAllParameters() {
.excludedGroups(List.of(FOO, BAR))
.excludedMethods("method")
.excludedMethods(List.of(FOO, BAR))
.excludedTestClasses("test")
.excludedRunners("runners")
.excludedTestClasses("test")
.exportLineCoverage(true)
.failWhenNoMutations(true)
.features("feature")
Expand All @@ -136,6 +137,7 @@ void checkAllParameters() {
.inputEncoding("encoding")
.jvmArgs("-XX:+UnlogregckDiagnosticVMOptions")
.jvmPath("path")
.maxMutationsPerClass(3)
.maxSurviving(1)
.mutableCodePaths("codePaths")
.mutationEngine("engine")
Expand Down Expand Up @@ -456,6 +458,14 @@ void jvmPath() {
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()
Expand Down

0 comments on commit e7ed7ed

Please sign in to comment.