diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index c0ba763..bf65051 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -22,11 +22,8 @@ jobs: distribution: "zulu" java-version: ${{ matrix.java-version }} - - name: Grant execute permission for bld - run: chmod +x bld - - - name: Download the dependencies + - name: Download dependencies run: ./bld download - - name: Run tests with bld + - name: Run tests run: ./bld compile test diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index a2969be..2fb5ff0 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/.vscode/settings.json b/.vscode/settings.json index d136e4d..33a9922 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-1.9.1.jar", + "${HOME}/.bld/dist/bld-2.0.0-SNAPSHOT.jar", "lib/**/*.jar" ] } diff --git a/examples/.gitignore b/examples/.gitignore index a2805aa..71a3cf3 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -52,4 +52,7 @@ atlassian-ide-plugin.xml .idea/sonarlint/ # Editor-based Rest Client -.idea/httpRequests \ No newline at end of file +.idea/httpRequests + + +reports \ No newline at end of file diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml index a2969be..2fb5ff0 100644 --- a/examples/.idea/libraries/bld.xml +++ b/examples/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json index d136e4d..33a9922 100644 --- a/examples/.vscode/settings.json +++ b/examples/.vscode/settings.json @@ -9,7 +9,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-1.9.1.jar", + "${HOME}/.bld/dist/bld-2.0.0-SNAPSHOT.jar", "lib/**/*.jar" ] } diff --git a/examples/lib/bld/bld-wrapper.jar b/examples/lib/bld/bld-wrapper.jar index c0de401..9b41714 100644 Binary files a/examples/lib/bld/bld-wrapper.jar and b/examples/lib/bld/bld-wrapper.jar differ diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index bfabcd9..ef5c8dc 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,7 +1,7 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-pitest=com.uwyn.rife2:bld-pitest:0.9.9-SNAPSHOT +bld.extension-pitest=com.uwyn.rife2:bld-pitest:0.9.8 bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES,MAVEN_LOCAL,RIFE2_SNAPSHOTS bld.sourceDirectories= -bld.version=1.9.1 +bld.version=2.0.0-SNAPSHOT diff --git a/examples/reports/mutations/com.example/ExamplesLib.java.html b/examples/reports/mutations/com.example/ExamplesLib.java.html deleted file mode 100644 index e57c4ee..0000000 --- a/examples/reports/mutations/com.example/ExamplesLib.java.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - -

ExamplesLib.java

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -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
Location : getMessage
Killed by : com.example.ExamplesTest.[engine:junit-jupiter]/[class:com.example.ExamplesTest]/[method:verifyHello()]
replaced return value with "" for com/example/ExamplesLib::getMessage → KILLED

-
- - -

Active mutators

-
    -
  • CONDITIONALS_BOUNDARY
  • -
  • EMPTY_RETURNS
  • -
  • FALSE_RETURNS
  • -
  • INCREMENTS
  • -
  • INVERT_NEGS
  • -
  • MATH
  • -
  • NEGATE_CONDITIONALS
  • -
  • NULL_RETURNS
  • -
  • PRIMITIVE_RETURNS
  • -
  • TRUE_RETURNS
  • -
  • VOID_METHOD_CALLS
  • - -
- -

Tests examined

-
    -
  • com.example.ExamplesTest.[engine:junit-jupiter]/[class:com.example.ExamplesTest]/[method:verifyHello()] (9 ms)
  • -
- -
- -Report generated by PIT \ No newline at end of file diff --git a/examples/reports/mutations/com.example/ExamplesTest.java.html b/examples/reports/mutations/com.example/ExamplesTest.java.html deleted file mode 100644 index 03b4b4b..0000000 --- a/examples/reports/mutations/com.example/ExamplesTest.java.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - -

ExamplesTest.java

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -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
Location : verifyHello
Killed by : none
removed call to org/junit/jupiter/api/Assertions::assertEquals → SURVIVED

-
- - -

Active mutators

-
    -
  • CONDITIONALS_BOUNDARY
  • -
  • EMPTY_RETURNS
  • -
  • FALSE_RETURNS
  • -
  • INCREMENTS
  • -
  • INVERT_NEGS
  • -
  • MATH
  • -
  • NEGATE_CONDITIONALS
  • -
  • NULL_RETURNS
  • -
  • PRIMITIVE_RETURNS
  • -
  • TRUE_RETURNS
  • -
  • VOID_METHOD_CALLS
  • - -
- -

Tests examined

-
    -
  • com.example.ExamplesTest.[engine:junit-jupiter]/[class:com.example.ExamplesTest]/[method:verifyHello()] (9 ms)
  • -
- -
- -Report generated by PIT \ No newline at end of file diff --git a/examples/reports/mutations/com.example/index.html b/examples/reports/mutations/com.example/index.html deleted file mode 100644 index d8896a7..0000000 --- a/examples/reports/mutations/com.example/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - -

Pit Test Coverage Report

-

Package Summary

-

com.example

- - - - - - - - - - - - - - - - - -
Number of ClassesLine CoverageMutation CoverageTest Strength
2100%
5/5
50%
1/2
50%
1/2
- - -

Breakdown by Class

- - - - - - - - - - - - - - - - - - - - - - - - - - -
NameLine CoverageMutation CoverageTest Strength
ExamplesLib.java
100%
2/2
100%
1/1
100%
1/1
ExamplesTest.java
100%
3/3
0%
0/1
0%
0/1
-
- - - -
- -Report generated by PIT \ No newline at end of file diff --git a/examples/reports/mutations/index.html b/examples/reports/mutations/index.html deleted file mode 100644 index 2693701..0000000 --- a/examples/reports/mutations/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - -

Pit Test Coverage Report

- -

Project Summary

- - - - - - - - - - - - - - - - - -
Number of ClassesLine CoverageMutation CoverageTest Strength
2100%
5/5
50%
1/2
50%
1/2
- - -

Breakdown by Package

- - - - - - - - - - - - - - - - - - - - - -
NameNumber of ClassesLine CoverageMutation CoverageTest Strength
com.example2
100%
5/5
50%
1/2
50%
1/2
-
- - - - -
- -
    -
- -Report generated by PIT \ No newline at end of file diff --git a/examples/reports/mutations/style.css b/examples/reports/mutations/style.css deleted file mode 100644 index 303bfba..0000000 --- a/examples/reports/mutations/style.css +++ /dev/null @@ -1,563 +0,0 @@ -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%; -} \ No newline at end of file diff --git a/examples/src/bld/java/com/example/ExamplesBuild.java b/examples/src/bld/java/com/example/ExamplesBuild.java index 885c188..39ae49d 100644 --- a/examples/src/bld/java/com/example/ExamplesBuild.java +++ b/examples/src/bld/java/com/example/ExamplesBuild.java @@ -30,8 +30,8 @@ public class ExamplesBuild extends Project { .include(dependency("org.pitest", "pitest", version(1, 16, 1))) .include(dependency("org.pitest", "pitest-command-line", version(1, 16, 1))) .include(dependency("org.pitest", "pitest-junit5-plugin", version(1, 2, 1))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2))); + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))); } public static void main(String[] args) { diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index 2ba556c..e4421c5 100644 Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 736a63c..9d4088a 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -2,8 +2,8 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.1 -bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5 -bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.0 +bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.6 +bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.2 bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.sourceDirectories= -bld.version=1.9.1 +bld.version=2.0.0-SNAPSHOT diff --git a/src/bld/java/rife/bld/extension/PitestOperationBuild.java b/src/bld/java/rife/bld/extension/PitestOperationBuild.java index c66e43c..60affa1 100644 --- a/src/bld/java/rife/bld/extension/PitestOperationBuild.java +++ b/src/bld/java/rife/bld/extension/PitestOperationBuild.java @@ -22,11 +22,9 @@ 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.Repository.*; import static rife.bld.dependencies.Scope.compile; import static rife.bld.dependencies.Scope.test; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; @@ -42,18 +40,18 @@ public class PitestOperationBuild extends Project { downloadSources = true; autoDownloadPurge = true; - repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); + repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS); var pitest = version(1, 16, 1); scope(compile) - .include(dependency("com.uwyn.rife2", "bld", version(1, 9, 1))); + .include(dependency("com.uwyn.rife2", "bld", version(2, 0, 0, "SNAPSHOT"))); scope(test) .include(dependency("org.pitest", "pitest", pitest)) .include(dependency("org.pitest", "pitest-command-line", pitest)) .include(dependency("org.pitest", "pitest-junit5-plugin", version(1, 2, 1))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2))) - .include(dependency("org.assertj", "assertj-core", version(3, 26, 0))); + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))) + .include(dependency("org.assertj", "assertj-core", version(3, 26, 3))); javadocOperation() .javadocOptions() @@ -96,14 +94,14 @@ public class PitestOperationBuild extends Project { } @BuildCommand(summary = "Generates JaCoCo Reports") - public void jacoco() throws IOException { + public void jacoco() throws Exception { new JacocoReportOperation() .fromProject(this) .execute(); } @BuildCommand(summary = "Runs PMD analysis") - public void pmd() { + public void pmd() throws Exception { new PmdOperation() .fromProject(this) .failOnViolation(true) diff --git a/src/main/java/rife/bld/extension/PitestOperation.java b/src/main/java/rife/bld/extension/PitestOperation.java index 5564cc7..36758ef 100644 --- a/src/main/java/rife/bld/extension/PitestOperation.java +++ b/src/main/java/rife/bld/extension/PitestOperation.java @@ -18,10 +18,14 @@ package rife.bld.extension; import rife.bld.BaseProject; import rife.bld.operations.AbstractProcessOperation; +import rife.bld.operations.exceptions.ExitStatusException; -import java.nio.file.Path; +import java.io.File; +import java.io.IOException; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Mutation testing and coverage with PIT. @@ -34,17 +38,12 @@ public class PitestOperation extends AbstractProcessOperation { * False constant. */ protected static final String FALSE = "false"; - /** - * Source directories command line option. - */ - protected static final String SOURCE_DIRS = "--sourceDirs"; /** * True constant. */ protected static final String TRUE = "true"; - /** - * The PIT options. - */ + private static final Logger LOGGER = Logger.getLogger(PitestOperation.class.getName()); + private static final String SOURCE_DIRS = "--sourceDirs"; private final Map options_ = new ConcurrentHashMap<>(); private BaseProject project_; @@ -330,33 +329,45 @@ public class PitestOperation extends AbstractProcessOperation { return this; } + @Override + public void execute() throws IOException, InterruptedException, ExitStatusException { + if (project_ == null) { + if (LOGGER.isLoggable(Level.SEVERE) && !silent()) { + LOGGER.severe("A project must be specified."); + } + throw new ExitStatusException(ExitStatusException.EXIT_FAILURE); + } else { + super.execute(); + } + } + /** * Part of the {@link #execute} operation, constructs the command list * to use for building the process. */ @Override protected List executeConstructProcessCommandList() { - if (project_ == null) { - throw new IllegalArgumentException("A project must be specified."); - } else if (!options_.containsKey(SOURCE_DIRS)) { - options_.put(SOURCE_DIRS, project_.srcDirectory().getPath()); - } - final List 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"); + if (project_ != null) { + args.add(javaTool()); + args.add("-cp"); + args.add(String.format("%s:%s:%s:%s", new File(project_.libTestDirectory(), "*"), + new File(project_.libCompileDirectory(), "*"), project_.buildMainDirectory(), + project_.buildTestDirectory())); + args.add("org.pitest.mutationtest.commandline.MutationCoverageReport"); - options_.forEach((k, v) -> { - args.add(k); - if (!v.isEmpty()) { - args.add(v); + if (!options_.containsKey(SOURCE_DIRS)) { + options_.put(SOURCE_DIRS, project_.srcDirectory().getPath()); } - }); + + options_.forEach((k, v) -> { + args.add(k); + if (!v.isEmpty()) { + args.add(v); + } + }); + } return args; } diff --git a/src/test/java/rife/bld/extension/PitestOperationTest.java b/src/test/java/rife/bld/extension/PitestOperationTest.java index 57623b2..0fb9902 100644 --- a/src/test/java/rife/bld/extension/PitestOperationTest.java +++ b/src/test/java/rife/bld/extension/PitestOperationTest.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import rife.bld.BaseProject; import rife.bld.Project; import rife.bld.WebProject; +import rife.bld.operations.exceptions.ExitStatusException; import java.io.IOException; import java.nio.file.Files; @@ -29,7 +30,8 @@ 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.*; +import static rife.bld.extension.PitestOperation.FALSE; +import static rife.bld.extension.PitestOperation.TRUE; class PitestOperationTest { private static final String AS_LIST = "as list"; @@ -287,6 +289,12 @@ 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() @@ -547,12 +555,12 @@ class PitestOperationTest { var op = new PitestOperation() .fromProject(new BaseProject()) .sourceDirs(FOO, BAR); - assertThat(op.options().get(SOURCE_DIRS)).isEqualTo(FOOBAR); + assertThat(op.options().get("--sourceDirs")).isEqualTo(FOOBAR); op = new PitestOperation() .fromProject(new Project()) .sourceDirs(List.of(FOO, BAR)); - assertThat(op.options().get(SOURCE_DIRS)).as(AS_LIST).isEqualTo(FOOBAR); + assertThat(op.options().get("--sourceDirs")).as(AS_LIST).isEqualTo(FOOBAR); } @Test