Cleaned up API to match bld operations aand options APIs
This commit is contained in:
parent
994bc399d6
commit
4e44484157
7 changed files with 153 additions and 18 deletions
|
@ -22,7 +22,7 @@ package rife.bld.extension;
|
|||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
@SuppressWarnings("PMD.TestClassWithoutTestCases")
|
||||
@SuppressWarnings({"PMD.TestClassWithoutTestCases", "unused"})
|
||||
class TestNgExample {
|
||||
public String getMessage() {
|
||||
return "Hello World!";
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.testng.annotations.Test;
|
|||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
class TestNgExampleTest {
|
||||
private final TestNgExample example = new TestNgExample();
|
||||
|
||||
|
|
|
@ -140,8 +140,16 @@ class TestNgOperationTest {
|
|||
|
||||
@Test
|
||||
void testDirectory() {
|
||||
var foo = new File("FOO");
|
||||
|
||||
var op = new TestNgOperation().directory(FOO);
|
||||
assertThat(op.options().get("-d")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-d")).as("as string").isEqualTo(FOO);
|
||||
|
||||
op = new TestNgOperation().directory(foo);
|
||||
assertThat(op.options().get("-d")).as("as file").isEqualTo(foo.getAbsolutePath());
|
||||
|
||||
op = new TestNgOperation().directory(foo.toPath());
|
||||
assertThat(op.options().get("-d")).as("as path").isEqualTo(foo.getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -401,11 +409,28 @@ class TestNgOperationTest {
|
|||
|
||||
@Test
|
||||
void testSourceDir() {
|
||||
var foo = new File(FOO);
|
||||
var bar = new File(BAR);
|
||||
|
||||
var foobar = String.format("%s;%s", FOO, BAR);
|
||||
var op = new TestNgOperation().sourceDir(FOO, BAR);
|
||||
assertThat(op.options().get("-sourcedir")).isEqualTo(String.format("%s;%s", FOO, BAR));
|
||||
assertThat(op.options().get("-sourcedir")).as("String...").isEqualTo(foobar);
|
||||
|
||||
op = new TestNgOperation().sourceDir(List.of(FOO, BAR));
|
||||
assertThat(op.options().get("-sourcedir")).as("as list").isEqualTo(String.format("%s;%s", FOO, BAR));
|
||||
assertThat(op.options().get("-sourcedir")).as("List(String...)").isEqualTo(foobar);
|
||||
|
||||
foobar = String.format("%s;%s", foo.getAbsolutePath(), bar.getAbsolutePath());
|
||||
op = new TestNgOperation().sourceDir(foo, bar);
|
||||
assertThat(op.options().get("-sourcedir")).as("File...").isEqualTo(foobar);
|
||||
|
||||
op = new TestNgOperation().sourceDirFiles(List.of(foo, bar));
|
||||
assertThat(op.options().get("-sourcedir")).as("List(String...)").isEqualTo(foobar);
|
||||
|
||||
op = new TestNgOperation().sourceDir(foo.toPath(), bar.toPath());
|
||||
assertThat(op.options().get("-sourcedir")).as("Path...").isEqualTo(foobar);
|
||||
|
||||
op = new TestNgOperation().sourceDirPaths(List.of(foo.toPath(), bar.toPath()));
|
||||
assertThat(op.options().get("-sourcedir")).as("List(Path...)").isEqualTo(foobar);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -479,7 +504,14 @@ class TestNgOperationTest {
|
|||
|
||||
@Test
|
||||
void testXmlPathInJar() {
|
||||
var foo = new File(FOO);
|
||||
var op = new TestNgOperation().xmlPathInJar(FOO);
|
||||
assertThat(op.options().get("-xmlpathinjar")).isEqualTo(FOO);
|
||||
assertThat(op.options().get("-xmlpathinjar")).as("as string").isEqualTo(FOO);
|
||||
|
||||
op = new TestNgOperation().xmlPathInJar(foo);
|
||||
assertThat(op.options().get("-xmlpathinjar")).as("as file").isEqualTo(foo.getAbsolutePath());
|
||||
|
||||
op = new TestNgOperation().xmlPathInJar(foo.toPath());
|
||||
assertThat(op.options().get("-xmlpathinjar")).as("as path").isEqualTo(foo.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue