Added more tests
This commit is contained in:
parent
3210364a2f
commit
ef570b7d05
2 changed files with 29 additions and 4 deletions
|
@ -27,7 +27,8 @@ 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.Scope.*;
|
||||
import static rife.bld.dependencies.Scope.compile;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
|
||||
|
||||
public class PitestOperationBuild extends Project {
|
||||
|
@ -44,6 +45,9 @@ public class PitestOperationBuild extends Project {
|
|||
scope(compile)
|
||||
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 2)));
|
||||
scope(test)
|
||||
.include(dependency("org.pitest", "pitest", version(1, 14, 4)))
|
||||
.include(dependency("org.pitest", "pitest-command-line", version(1, 14, 4)))
|
||||
.include(dependency("org.pitest", "pitest-junit5-plugin", version(1,2, 0)))
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
|
||||
.include(dependency("org.assertj:assertj-joda-time:2.2.0"));
|
||||
|
|
|
@ -21,9 +21,13 @@ import rife.bld.BaseProject;
|
|||
import rife.bld.Project;
|
||||
import rife.bld.WebProject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
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.*;
|
||||
|
||||
class PitestOperationTest {
|
||||
|
@ -109,8 +113,8 @@ class PitestOperationTest {
|
|||
|
||||
op = new PitestOperation()
|
||||
.fromProject(new Project())
|
||||
.excludedClasses(List.of(FOO, BAR));
|
||||
assertThat(op.options.get("--excludedClasses")).as(AS_LIST).isEqualTo(FOOBAR);
|
||||
.excludedClasses(Set.of(FOO, BAR));
|
||||
assertThat(op.options.get("--excludedClasses")).as("as set").contains(FOO).contains(BAR).contains(",");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -149,7 +153,24 @@ class PitestOperationTest {
|
|||
op = new PitestOperation()
|
||||
.fromProject(new Project())
|
||||
.excludedTests(List.of(FOO, BAR));
|
||||
assertThat(op.options.get("--excludedTests")).as(AS_LIST).isEqualTo(FOOBAR);
|
||||
assertThat(op.options.get("--excludedTests")).as("as list").isEqualTo(FOOBAR);
|
||||
}
|
||||
|
||||
@Test
|
||||
void execute() throws IOException {
|
||||
var tmpDir = Files.createTempDirectory("bld-pitest");
|
||||
tmpDir.toFile().deleteOnExit();
|
||||
var op = new PitestOperation().
|
||||
fromProject(new WebProject())
|
||||
.reportDir(tmpDir.toAbsolutePath().toString())
|
||||
.targetClasses("com.example.*")
|
||||
.targetTests("com.example.*")
|
||||
.verbose(true)
|
||||
.failWhenNoMutations(false)
|
||||
.sourceDirs("examples/src");
|
||||
|
||||
assertThatCode(op::execute).doesNotThrowAnyException();
|
||||
assertThat(tmpDir).isEmptyDirectory();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue