From 893617c8bcfd50a9c22023177c80db9973e36d8f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 28 Nov 2021 16:16:55 +0100 Subject: [PATCH] Fix Javadoc of DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME --- .../core/LauncherDiscoveryRequestBuilder.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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 d9e7ce3a2c52..f8fe906fcac6 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 @@ -92,10 +92,12 @@ public final class LauncherDiscoveryRequestBuilder { * *

Supported values are {@code "logging"} and {@code "abortOnFailure"}. * - *

If not specified, the default is {@code "logging"}. + *

If not specified, the default is {@value #DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_VALUE}. */ public static final String DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME = "junit.platform.discovery.listener.default"; + private static final String DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_VALUE = "abortOnFailure"; + private final List selectors = new ArrayList<>(); private final List engineFilters = new ArrayList<>(); private final List> discoveryFilters = new ArrayList<>(); @@ -305,11 +307,8 @@ private LauncherConfigurationParameters buildLauncherConfigurationParameters() { } private LauncherDiscoveryListener getLauncherDiscoveryListener(ConfigurationParameters configurationParameters) { - LauncherDiscoveryListener defaultDiscoveryListener = configurationParameters.get( - DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME) // - .map(value -> LauncherDiscoveryListeners.fromConfigurationParameter( - DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME, value)) // - .orElseGet(LauncherDiscoveryListeners::abortOnFailure); + LauncherDiscoveryListener defaultDiscoveryListener = getDefaultLauncherDiscoveryListener( + configurationParameters); if (discoveryListeners.isEmpty()) { return defaultDiscoveryListener; } @@ -322,4 +321,12 @@ private LauncherDiscoveryListener getLauncherDiscoveryListener(ConfigurationPara return LauncherDiscoveryListeners.composite(allDiscoveryListeners); } + private LauncherDiscoveryListener getDefaultLauncherDiscoveryListener( + ConfigurationParameters configurationParameters) { + String value = configurationParameters.get(DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME) // + .orElse(DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_VALUE); + return LauncherDiscoveryListeners.fromConfigurationParameter( + DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME, value); + } + }