Class PrefixedConfigurationParameters
- java.lang.Object
-
- org.junit.platform.engine.support.config.PrefixedConfigurationParameters
-
- All Implemented Interfaces:
ConfigurationParameters
@API(status=STABLE, since="1.10") public class PrefixedConfigurationParameters extends java.lang.Object implements ConfigurationParameters
View ofConfigurationParameters
that applies a supplied prefix to all queries.- Since:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field Description private ConfigurationParameters
delegate
private java.lang.String
prefix
-
Fields inherited from interface org.junit.platform.engine.ConfigurationParameters
CONFIG_FILE_NAME
-
-
Constructor Summary
Constructors Constructor Description PrefixedConfigurationParameters(ConfigurationParameters delegate, java.lang.String prefix)
Create a new view of the suppliedConfigurationParameters
that applies the supplied prefix to all queries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
get(java.lang.String key)
Get the configuration parameter stored under the specifiedkey
.<T> java.util.Optional<T>
get(java.lang.String key, java.util.function.Function<java.lang.String,T> transformer)
Get and transform the configuration parameter stored under the specifiedkey
using the specifiedtransformer
.java.util.Optional<java.lang.Boolean>
getBoolean(java.lang.String key)
Get the boolean configuration parameter stored under the specifiedkey
.java.util.Set<java.lang.String>
keySet()
Get the keys of all configuration parameters stored in thisConfigurationParameters
.private java.lang.String
prefixed(java.lang.String key)
int
size()
Get the number of configuration parameters stored directly in thisConfigurationParameters
.
-
-
-
Field Detail
-
delegate
private final ConfigurationParameters delegate
-
prefix
private final java.lang.String prefix
-
-
Constructor Detail
-
PrefixedConfigurationParameters
public PrefixedConfigurationParameters(ConfigurationParameters delegate, java.lang.String prefix)
Create a new view of the suppliedConfigurationParameters
that applies the supplied prefix to all queries.- Parameters:
delegate
- theConfigurationParameters
to delegate to; nevernull
prefix
- the prefix to apply to all queries; nevernull
or blank
-
-
Method Detail
-
get
public java.util.Optional<java.lang.String> get(java.lang.String key)
Description copied from interface:ConfigurationParameters
Get the configuration parameter stored under the specifiedkey
.If no such key is present in this
ConfigurationParameters
, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.- Specified by:
get
in interfaceConfigurationParameters
- Parameters:
key
- the key to look up; nevernull
or blank- Returns:
- an
Optional
containing the value; nevernull
but potentially empty - See Also:
ConfigurationParameters.getBoolean(String)
,System.getProperty(String)
,ConfigurationParameters.CONFIG_FILE_NAME
-
getBoolean
public java.util.Optional<java.lang.Boolean> getBoolean(java.lang.String key)
Description copied from interface:ConfigurationParameters
Get the boolean configuration parameter stored under the specifiedkey
.If no such key is present in this
ConfigurationParameters
, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.- Specified by:
getBoolean
in interfaceConfigurationParameters
- Parameters:
key
- the key to look up; nevernull
or blank- Returns:
- an
Optional
containing the value; nevernull
but potentially empty - See Also:
ConfigurationParameters.get(String)
,Boolean.parseBoolean(String)
,System.getProperty(String)
,ConfigurationParameters.CONFIG_FILE_NAME
-
get
public <T> java.util.Optional<T> get(java.lang.String key, java.util.function.Function<java.lang.String,T> transformer)
Description copied from interface:ConfigurationParameters
Get and transform the configuration parameter stored under the specifiedkey
using the specifiedtransformer
.If no such key is present in this
ConfigurationParameters
, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.In case the transformer throws an exception, it will be wrapped in a
JUnitException
with a helpful message.- Specified by:
get
in interfaceConfigurationParameters
- Parameters:
key
- the key to look up; nevernull
or blanktransformer
- the transformer to apply in case a value is found; nevernull
- Returns:
- an
Optional
containing the value; nevernull
but potentially empty - See Also:
ConfigurationParameters.getBoolean(String)
,System.getProperty(String)
,ConfigurationParameters.CONFIG_FILE_NAME
-
prefixed
private java.lang.String prefixed(java.lang.String key)
-
size
public int size()
Description copied from interface:ConfigurationParameters
Get the number of configuration parameters stored directly in thisConfigurationParameters
.- Specified by:
size
in interfaceConfigurationParameters
-
keySet
public java.util.Set<java.lang.String> keySet()
Description copied from interface:ConfigurationParameters
Get the keys of all configuration parameters stored in thisConfigurationParameters
.- Specified by:
keySet
in interfaceConfigurationParameters
- Returns:
- the set of keys contained in this
ConfigurationParameters
-
-