Class PrefixedConfigurationParameters
- java.lang.Object
-
- org.junit.platform.engine.support.config.PrefixedConfigurationParameters
-
- All Implemented Interfaces:
ConfigurationParameters
@API(status=EXPERIMENTAL, since="1.3") public class PrefixedConfigurationParameters extends Object implements ConfigurationParameters
View ofConfigurationParametersthat applies a supplied prefix to all queries.- Since:
- 1.3
-
-
Field Summary
-
Fields inherited from interface org.junit.platform.engine.ConfigurationParameters
CONFIG_FILE_NAME
-
-
Constructor Summary
Constructors Constructor Description PrefixedConfigurationParameters(ConfigurationParameters delegate, String prefix)Create a new view of the suppliedConfigurationParametersthat applies the supplied prefix to all queries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>get(String key)Get the configuration parameter stored under the specifiedkey.<T> Optional<T>get(String key, Function<String,T> transformer)Get and transform the configuration parameter stored under the specifiedkeyusing the specifiedtransformer.Optional<Boolean>getBoolean(String key)Get the boolean configuration parameter stored under the specifiedkey.intsize()Get the number of configuration parameters stored directly in thisConfigurationParameters.
-
-
-
Constructor Detail
-
PrefixedConfigurationParameters
public PrefixedConfigurationParameters(ConfigurationParameters delegate, String prefix)
Create a new view of the suppliedConfigurationParametersthat applies the supplied prefix to all queries.- Parameters:
delegate- theConfigurationParametersto delegate to; nevernullprefix- the prefix to apply to all queries; nevernull
-
-
Method Detail
-
get
public Optional<String> get(String key)
Description copied from interface:ConfigurationParametersGet 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:
getin interfaceConfigurationParameters- Parameters:
key- the key to look up; nevernullor blank- Returns:
- an
Optionalcontaining the value; nevernullbut potentially empty - See Also:
ConfigurationParameters.getBoolean(String),System.getProperty(String),ConfigurationParameters.CONFIG_FILE_NAME
-
getBoolean
public Optional<Boolean> getBoolean(String key)
Description copied from interface:ConfigurationParametersGet 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:
getBooleanin interfaceConfigurationParameters- Parameters:
key- the key to look up; nevernullor blank- Returns:
- an
Optionalcontaining the value; nevernullbut potentially empty - See Also:
ConfigurationParameters.get(String),Boolean.parseBoolean(String),System.getProperty(String),ConfigurationParameters.CONFIG_FILE_NAME
-
get
public <T> Optional<T> get(String key, Function<String,T> transformer)
Description copied from interface:ConfigurationParametersGet and transform the configuration parameter stored under the specifiedkeyusing 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
JUnitExceptionwith a helpful message.- Specified by:
getin interfaceConfigurationParameters- Parameters:
key- the key to look up; nevernullor blanktransformer- the transformer to apply in case a value is found; nevernull- Returns:
- an
Optionalcontaining the value; nevernullbut potentially empty - See Also:
ConfigurationParameters.getBoolean(String),System.getProperty(String),ConfigurationParameters.CONFIG_FILE_NAME
-
size
public int size()
Description copied from interface:ConfigurationParametersGet the number of configuration parameters stored directly in thisConfigurationParameters.- Specified by:
sizein interfaceConfigurationParameters
-
-