return this;
}
- /**
- * The directory where the reports will be generated
- *
- * Default is {@code build/test-output})
- *
- * @param directoryPath the directory path
- * @return this operation instance
- */
- public TestNgOperation directory(File directoryPath) {
- return directory(directoryPath.getAbsolutePath());
- }
-
- /**
- * The directory where the reports will be generated
- *
- * Default is {@code build/test-output})
- *
- * @param directoryPath the directory path
- * @return this operation instance
- */
- public TestNgOperation directory(Path directoryPath) {
- return directory(directoryPath.toFile());
- }
-
/**
* The list of groups you want to be excluded from this run.
*
@@ -702,49 +678,10 @@ public class TestNgOperation extends TestOperation
*
* @param directory one or more directories
* @return this operation instance
- * @see #sourceDir(Collection)
+ * @see #sourceDir(String...) #sourceDir(String...)
*/
public TestNgOperation sourceDir(String... directory) {
- return sourceDir(List.of(directory));
- }
-
- /**
- * The directories where your javadoc annotated test sources are. This option is only necessary
- * if you are using javadoc type annotations. (e.g. {@code "src/test"} or
- * {@code "src/test/org/testng/eclipse-plugin", "src/test/org/testng/testng"}).
- *
- * @param directory one or more directories
- * @return this operation instance
- * @see #sourceDirFiles(Collection)
- */
- public TestNgOperation sourceDir(File... directory) {
- return sourceDirFiles(List.of(directory));
- }
-
- /**
- * The directories where your javadoc annotated test sources are. This option is only necessary
- * if you are using javadoc type annotations. (e.g. {@code "src/test"} or
- * {@code "src/test/org/testng/eclipse-plugin", "src/test/org/testng/testng"}).
- *
- * @param directory one or more directories
- * @return this operation instance
- * @see #sourceDirPaths(Collection)
- */
- public TestNgOperation sourceDir(Path... directory) {
- return sourceDirPaths(List.of(directory));
- }
-
- /**
- * The directories where your javadoc annotated test sources are. This option is only necessary
- * if you are using javadoc type annotations. (e.g. {@code "src/test"} or
- * {@code "src/test/org/testng/eclipse-plugin", "src/test/org/testng/testng"}).
- *
- * @param directory the list of directories
- * @return this operation instance
- * @see #sourceDir(String...)
- */
- public TestNgOperation sourceDir(Collection directory) {
- options_.put("-sourcedir", String.join(";", directory.stream().filter(this::isNotBlank).toList()));
+ options_.put("-sourcedir", String.join(";", Arrays.stream(directory).filter(this::isNotBlank).toList()));
return this;
}
@@ -755,23 +692,11 @@ public class TestNgOperation extends TestOperation
*
* @param directory the list of directories
* @return this operation instance
- * @see #sourceDir(File...)
+ * @see #sourceDir(String...) #sourceDir(String...)
*/
- public TestNgOperation sourceDirFiles(Collection directory) {
- return sourceDir(directory.stream().map(File::getAbsolutePath).toList());
- }
-
- /**
- * The directories where your javadoc annotated test sources are. This option is only necessary
- * if you are using javadoc type annotations. (e.g. {@code "src/test"} or
- * {@code "src/test/org/testng/eclipse-plugin", "src/test/org/testng/testng"}).
- *
- * @param directory the list of directories
- * @return this operation instance
- * @see #sourceDir(Path...)
- */
- public TestNgOperation sourceDirPaths(Collection directory) {
- return sourceDirFiles(directory.stream().map(Path::toFile).toList());
+ public TestNgOperation sourceDir(Collection directory) {
+ options_.put("-sourcedir", String.join(";", directory.stream().filter(this::isNotBlank).toList()));
+ return this;
}
/**
@@ -1106,30 +1031,6 @@ public class TestNgOperation extends TestOperation
return this;
}
- /**
- * This attribute should contain the path to a valid XML file inside the test jar
- * (e.g. {@code "resources/testng.xml"}). The default is {@code testng.xml}, which means a file called
- * {@code testng.xml} at the root of the jar file. This option will be ignored unless a test jar is specified.
- *
- * @param path the path
- * @return this operation instance
- */
- public TestNgOperation xmlPathInJar(File path) {
- return xmlPathInJar(path.getAbsolutePath());
- }
-
- /**
- * This attribute should contain the path to a valid XML file inside the test jar
- * (e.g. {@code "resources/testng.xml"}). The default is {@code testng.xml}, which means a file called
- * {@code testng.xml} at the root of the jar file. This option will be ignored unless a test jar is specified.
- *
- * @param path the path
- * @return this operation instance
- */
- public TestNgOperation xmlPathInJar(Path path) {
- return xmlPathInJar(path.toFile());
- }
-
/**
* Parallel Mechanisms
*/
diff --git a/src/test/java/rife/bld/extension/TestNgExample.java b/src/test/java/rife/bld/extension/TestNgExample.java
index bfe36ca..c2dc3e0 100644
--- a/src/test/java/rife/bld/extension/TestNgExample.java
+++ b/src/test/java/rife/bld/extension/TestNgExample.java
@@ -22,7 +22,7 @@ package rife.bld.extension;
* @author Erik C. Thauvin
* @since 1.0
*/
-@SuppressWarnings({"PMD.TestClassWithoutTestCases", "unused"})
+@SuppressWarnings("PMD.TestClassWithoutTestCases")
class TestNgExample {
public String getMessage() {
return "Hello World!";
diff --git a/src/test/java/rife/bld/extension/TestNgExampleTest.java b/src/test/java/rife/bld/extension/TestNgExampleTest.java
index bc8cac5..a2c35b9 100644
--- a/src/test/java/rife/bld/extension/TestNgExampleTest.java
+++ b/src/test/java/rife/bld/extension/TestNgExampleTest.java
@@ -25,7 +25,6 @@ import org.testng.annotations.Test;
* @author Erik C. Thauvin
* @since 1.0
*/
-@SuppressWarnings("unused")
class TestNgExampleTest {
private final TestNgExample example = new TestNgExample();
diff --git a/src/test/java/rife/bld/extension/TestNgOperationTest.java b/src/test/java/rife/bld/extension/TestNgOperationTest.java
index b6e97b7..83b1f80 100644
--- a/src/test/java/rife/bld/extension/TestNgOperationTest.java
+++ b/src/test/java/rife/bld/extension/TestNgOperationTest.java
@@ -140,16 +140,8 @@ class TestNgOperationTest {
@Test
void testDirectory() {
- var foo = new File("FOO");
-
var op = new TestNgOperation().directory(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());
+ assertThat(op.options().get("-d")).isEqualTo(FOO);
}
@Test
@@ -409,28 +401,11 @@ 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")).as("String...").isEqualTo(foobar);
+ assertThat(op.options().get("-sourcedir")).isEqualTo(String.format("%s;%s", FOO, BAR));
op = new TestNgOperation().sourceDir(List.of(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);
+ assertThat(op.options().get("-sourcedir")).as("as list").isEqualTo(String.format("%s;%s", FOO, BAR));
}
@Test
@@ -504,14 +479,7 @@ class TestNgOperationTest {
@Test
void testXmlPathInJar() {
- var foo = new File(FOO);
var op = new TestNgOperation().xmlPathInJar(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());
+ assertThat(op.options().get("-xmlpathinjar")).isEqualTo(FOO);
}
}