Skip to content

Commit

Permalink
Fix Javadoc of DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Nov 28, 2021
1 parent 3d75f99 commit 893617c
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ public final class LauncherDiscoveryRequestBuilder {
*
* <p>Supported values are {@code "logging"} and {@code "abortOnFailure"}.
*
* <p>If not specified, the default is {@code "logging"}.
* <p>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<DiscoverySelector> selectors = new ArrayList<>();
private final List<EngineFilter> engineFilters = new ArrayList<>();
private final List<DiscoveryFilter<?>> discoveryFilters = new ArrayList<>();
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}

}

0 comments on commit 893617c

Please sign in to comment.