diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java index 3b46df45e24..744fd1a71be 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java @@ -124,7 +124,7 @@ public LauncherDiscoveryRequestBuilder() { } /** - * Add all of the supplied {@code selectors} to the request. + * Add all supplied {@code selectors} to the request. * * @param selectors the {@code DiscoverySelectors} to add; never {@code null} * @return this builder for method chaining @@ -136,7 +136,7 @@ public LauncherDiscoveryRequestBuilder selectors(DiscoverySelector... selectors) } /** - * Add all of the supplied {@code selectors} to the request. + * Add all supplied {@code selectors} to the request. * * @param selectors the {@code DiscoverySelectors} to add; never {@code null} * @return this builder for method chaining @@ -149,7 +149,7 @@ public LauncherDiscoveryRequestBuilder selectors(List extends DiscoverySelecto } /** - * Add all of the supplied {@code filters} to the request. + * Add all supplied {@code filters} to the request. * *
The {@code filters} are combined using AND semantics, i.e. all of them
* have to include a resource for it to end up in the test plan.
@@ -185,7 +185,7 @@ public LauncherDiscoveryRequestBuilder configurationParameter(String key, String
}
/**
- * Add all of the supplied configuration parameters to the request.
+ * Add all supplied configuration parameters to the request.
*
* @param configurationParameters the map of configuration parameters to add;
* never {@code null}
@@ -206,23 +206,46 @@ public LauncherDiscoveryRequestBuilder configurationParameters(Map In addition to the {@linkplain LauncherDiscoveryListener listeners}
* registered using this method, this builder will add a default listener
@@ -246,25 +269,6 @@ public LauncherDiscoveryRequestBuilder listeners(LauncherDiscoveryListener... li
return this;
}
- /**
- * Configure whether implicit configuration parameters should be considered.
- *
- * By default, in addition to those parameters that are passed explicitly
- * to this builder, configuration parameters are read from system properties
- * and from the {@code junit-platform.properties} classpath resource.
- * Passing {@code false} to this method, disables the latter two sources so
- * that only explicit configuration parameters are taken into account.
- *
- * @since 1.7
- * @see #configurationParameter(String, String)
- * @see #configurationParameters(Map)
- */
- @API(status = STABLE, since = "1.10")
- public LauncherDiscoveryRequestBuilder enableImplicitConfigurationParameters(boolean enabled) {
- this.implicitConfigurationParametersEnabled = enabled;
- return this;
- }
-
private void storeFilter(Filter> filter) {
if (filter instanceof EngineFilter) {
this.engineFilters.add((EngineFilter) filter);
@@ -298,7 +302,7 @@ private LauncherConfigurationParameters buildLauncherConfigurationParameters() {
.explicitParameters(this.configurationParameters) //
.enableImplicitProviders(this.implicitConfigurationParametersEnabled);
- if (parentConfigurationParameters != null) {
+ if (this.parentConfigurationParameters != null) {
builder.parentConfigurationParameters(this.parentConfigurationParameters);
}
@@ -308,14 +312,14 @@ private LauncherConfigurationParameters buildLauncherConfigurationParameters() {
private LauncherDiscoveryListener getLauncherDiscoveryListener(ConfigurationParameters configurationParameters) {
LauncherDiscoveryListener defaultDiscoveryListener = getDefaultLauncherDiscoveryListener(
configurationParameters);
- if (discoveryListeners.isEmpty()) {
+ if (this.discoveryListeners.isEmpty()) {
return defaultDiscoveryListener;
}
- if (discoveryListeners.contains(defaultDiscoveryListener)) {
- return LauncherDiscoveryListeners.composite(discoveryListeners);
+ if (this.discoveryListeners.contains(defaultDiscoveryListener)) {
+ return LauncherDiscoveryListeners.composite(this.discoveryListeners);
}
- List If set to {@code true}, standard class name patterns are filtered.
- *
- * @param filterStandardClassNamePatterns {@code true} to filter standard class name patterns,
- * {@code false} otherwise
- * @return this builder for method chaining
- */
- public SuiteLauncherDiscoveryRequestBuilder filterStandardClassNamePatterns(
- boolean filterStandardClassNamePatterns) {
- this.filterStandardClassNamePatterns = filterStandardClassNamePatterns;
- return this;
- }
-
- /**
- * Add all the supplied {@code selectors} to the request.
+ * Add all supplied {@code selectors} to the request.
*
* @param selectors the {@code DiscoverySelectors} to add; never {@code null}
* @return this builder for method chaining
*/
public SuiteLauncherDiscoveryRequestBuilder selectors(DiscoverySelector... selectors) {
- delegate.selectors(selectors);
+ this.delegate.selectors(selectors);
return this;
}
/**
- * Add all the supplied {@code selectors} to the request.
+ * Add all supplied {@code selectors} to the request.
*
* @param selectors the {@code DiscoverySelectors} to add; never {@code null}
* @return this builder for method chaining
*/
public SuiteLauncherDiscoveryRequestBuilder selectors(List extends DiscoverySelector> selectors) {
- delegate.selectors(selectors);
+ this.delegate.selectors(selectors);
return this;
}
/**
- * Add all the supplied {@code filters} to the request.
+ * Add all supplied {@code filters} to the request.
*
* The {@code filters} are combined using AND semantics, i.e. all of them
* have to include a resource for it to end up in the test plan.
@@ -181,7 +168,21 @@ public SuiteLauncherDiscoveryRequestBuilder selectors(List extends DiscoverySe
* @return this builder for method chaining
*/
public SuiteLauncherDiscoveryRequestBuilder filters(Filter>... filters) {
- delegate.filters(filters);
+ this.delegate.filters(filters);
+ return this;
+ }
+
+ /**
+ * Specify whether to filter standard class name patterns.
+ * If set to {@code true}, standard class name patterns are filtered.
+ *
+ * @param filterStandardClassNamePatterns {@code true} to filter standard class
+ * name patterns, {@code false} otherwise
+ * @return this builder for method chaining
+ */
+ public SuiteLauncherDiscoveryRequestBuilder filterStandardClassNamePatterns(
+ boolean filterStandardClassNamePatterns) {
+ this.filterStandardClassNamePatterns = filterStandardClassNamePatterns;
return this;
}
@@ -194,12 +195,12 @@ public SuiteLauncherDiscoveryRequestBuilder filters(Filter>... filters) {
* @return this builder for method chaining
*/
public SuiteLauncherDiscoveryRequestBuilder configurationParameter(String key, String value) {
- delegate.configurationParameter(key, value);
+ this.delegate.configurationParameter(key, value);
return this;
}
/**
- * Add all the supplied configuration parameters to the request.
+ * Add all supplied configuration parameters to the request.
*
* @param configurationParameters the map of configuration parameters to add;
* never {@code null}
@@ -207,7 +208,7 @@ public SuiteLauncherDiscoveryRequestBuilder configurationParameter(String key, S
* @see #configurationParameter(String, String)
*/
public SuiteLauncherDiscoveryRequestBuilder configurationParameters(MapExample
*
* {@code
* SuiteLauncherDiscoveryRequestBuilder.request()
- * .selectors(
- * selectPackage("org.example.user"),
- * selectClass("org.example.payment.PaymentTests"),
- * selectClass(File.class),
- * selectMethod("org.example.order.OrderTests#test1"),
- * selectMethod("org.example.order.OrderTests#test2()"),
- * selectMethod("org.example.order.OrderTests#test3(java.lang.String)"),
- * selectMethod("org.example.order.OrderTests", "test4"),
- * selectMethod(OrderTests.class, "test5"),
- * selectMethod(OrderTests.class, testMethod),
- * selectClasspathRoots(Collections.singleton(Paths.get("/my/local/path1"))),
- * selectUniqueId("unique-id-1"),
- * selectUniqueId("unique-id-2")
- * )
- * .filters(
- * includeEngines("junit-jupiter", "spek"),
- * // excludeEngines("junit-vintage"),
- * includeTags("fast"),
- * // excludeTags("slow"),
- * includeClassNamePatterns(".*Test[s]?")
- * // includeClassNamePatterns("org\.example\.tests.*")
- * )
- * .configurationParameter("key", "value")
- * .enableImplicitConfigurationParameters(true)
- * .suite(File.class)
- * .build();
+ * .selectors(
+ * selectPackage("org.example.user"),
+ * selectClass("org.example.payment.PaymentTests"),
+ * selectClass(ShippingTests.class),
+ * selectMethod("org.example.order.OrderTests#test1"),
+ * selectMethod("org.example.order.OrderTests#test2()"),
+ * selectMethod("org.example.order.OrderTests#test3(java.lang.String)"),
+ * selectMethod("org.example.order.OrderTests", "test4"),
+ * selectMethod(OrderTests.class, "test5"),
+ * selectMethod(OrderTests.class, testMethod),
+ * selectClasspathRoots(Collections.singleton(Paths.get("/my/local/path1"))),
+ * selectUniqueId("unique-id-1"),
+ * selectUniqueId("unique-id-2")
+ * )
+ * .filters(
+ * includeEngines("junit-jupiter", "spek"),
+ * // excludeEngines("junit-vintage"),
+ * includeTags("fast"),
+ * // excludeTags("slow"),
+ * includeClassNamePatterns(".*Test[s]?")
+ * // includeClassNamePatterns("org\.example\.tests.*")
+ * )
+ * .configurationParameter("key", "value")
+ * .enableImplicitConfigurationParameters(true)
+ * .suite(File.class)
+ * .build();
* }
*
* @since 1.8
@@ -121,7 +122,7 @@ private SuiteLauncherDiscoveryRequestBuilder() {
}
/**
- * Creates a mew instance of {@code SuiteLauncherDiscoveryRequestBuilder}
+ * Create a new {@code SuiteLauncherDiscoveryRequestBuilder}.
*
* @return a new builder
*/
@@ -130,43 +131,29 @@ public static SuiteLauncherDiscoveryRequestBuilder request() {
}
/**
- * Specifies whether to filter standard class name patterns.
- *