}
/**
- * The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
- *
- * A fully qualified class name that implements {@code org.testng.ITestObjectFactory} which can be used to create
+ * Fully qualified class name that implements {@code org.testng.ITestObjectFactory} which can be used to create
* test class and listener instances.
*
- * @param factory one or more factory
+ * @param objectFactory the object factory
* @return this operation instance
- * @see #objectFactory(Collection) #objectFactory(Collection)
*/
- public TestNgOperation objectFactory(String... factory) {
- return objectFactory(List.of(factory));
+ public TestNgOperation objectFactory(String objectFactory) {
+ options_.put("-objectfactory", objectFactory);
+ return this;
+ }
+
+ /**
+ * The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
+ *
+ * @param factory one or more factories
+ * @return this operation instance
+ * @see #objectFactory(Collection) #objectFactory(Collection)
+ */
+ public TestNgOperation objectFactory(String... factory) {
+ options_.put("-objectfactory", String.join(",", Arrays.stream(factory).filter(this::isNotBlank).toList()));
+ return this;
}
/**
* The list of {@code .class} files or class names implementing {@code ITestRunnerFactory}.
- *
- * A fully qualified class name that implements {@code org.testng.ITestObjectFactory} which can be used to create
- * test class and listener instances.
*
* @param factory the list of factories
* @return this operation instance
@@ -557,7 +570,9 @@ public class TestNgOperation extends TestOperation
* @see #overrideIncludedMethods(Collection) #overrideIncludedMethods(Collection)
*/
public TestNgOperation overrideIncludedMethods(String... method) {
- return overrideIncludedMethods(List.of(method));
+ options_.put("-overrideincludedmethods",
+ String.join(",", Arrays.stream(method).filter(this::isNotBlank).toList()));
+ return this;
}
/**
@@ -585,7 +600,8 @@ public class TestNgOperation extends TestOperation
* @see #packages(Collection) #packages(Collection)
*/
public TestNgOperation packages(String... name) {
- return packages(List.of(name));
+ packages_.addAll(Arrays.stream(name).filter(this::isNotBlank).toList());
+ return this;
}
/**
@@ -767,7 +783,9 @@ public class TestNgOperation extends TestOperation
* @see #spiListenersToSkip(Collection) #spiListenersToSkip(Collection)
*/
public TestNgOperation spiListenersToSkip(String... listenerToSkip) {
- return spiListenersToSkip(List.of(listenerToSkip));
+ options_.put("-spilistenerstoskip",
+ String.join(",", Arrays.stream(listenerToSkip).filter(this::isNotBlank).toList()));
+ return this;
}
/**
@@ -822,7 +840,8 @@ public class TestNgOperation extends TestOperation
* @see #suites(Collection) #suites(Collection)
*/
public TestNgOperation suites(String... suite) {
- return suites(List.of(suite));
+ suites_.addAll(Arrays.stream(suite).filter(this::isNotBlank).toList());
+ return this;
}
/**
@@ -869,7 +888,8 @@ public class TestNgOperation extends TestOperation
* @see #testClass(Collection) #testClass(Collection)
*/
public TestNgOperation testClass(String... aClass) {
- return testClass(List.of(aClass));
+ options_.put("-testclass", String.join(",", Arrays.stream(aClass).filter(this::isNotBlank).toList()));
+ return this;
}
/**
@@ -894,7 +914,8 @@ public class TestNgOperation extends TestOperation
* @see #testClasspath(String...) #testClasspath(String...)
*/
public TestNgOperation testClasspath(String... entry) {
- return testClasspath(List.of(entry));
+ testClasspath_.addAll(Arrays.stream(entry).filter(this::isNotBlank).toList());
+ return this;
}
/**
@@ -955,7 +976,9 @@ public class TestNgOperation extends TestOperation
* @see #testNames(Collection) #testNames(Collection)
*/
public TestNgOperation testNames(String... name) {
- return testNames(List.of(name));
+ options_.put("-testnames",
+ Arrays.stream(name).filter(this::isNotBlank).map(s -> '"' + s + '"').collect(Collectors.joining(",")));
+ return this;
}
/**
diff --git a/src/test/java/rife/bld/extension/TestNgExample.java b/src/test/java/rife/bld/extension/TestNgExample.java
index abe0606..bfe36ca 100644
--- a/src/test/java/rife/bld/extension/TestNgExample.java
+++ b/src/test/java/rife/bld/extension/TestNgExample.java
@@ -24,7 +24,6 @@ package rife.bld.extension;
*/
@SuppressWarnings({"PMD.TestClassWithoutTestCases", "unused"})
class TestNgExample {
- @SuppressWarnings("SameReturnValue")
public String getMessage() {
return "Hello World!";
}