A map of configuration data.
A ConfigMap
can be populated from the Runner
command line via -D
arguments. Runner
passes it to many methods where you can use it to configure your test runs. For example, Runner
passed the ConfigMap
to:
-
the
apply
method ofReporter
s viaRunStarting
events -
the
run
method ofSuite
-
the
runNestedSuites
method ofSuite
-
the
runTests
method ofSuite
-
the
runTest
method ofSuite
-
the
withFixture(NoArgTest)
method ofSuite
-
the
withFixture(OneArgTest)
method offixture.Suite
-
the
beforeEach(TestData)
method ofBeforeAndAfterEachTestData
-
the
afterEach(TestData)
method ofBeforeAndAfterEachTestData
In addition to accessing the ConfigMap
in overriden implementations of the above methods, you can also transform and pass along a modified ConfigMap
.
A ConfigMap
maps string keys to values of any type, i.e., it is a Map[String, Any]
. To get a configuration value in a variable of the actual type of that value, therefore, you'll need to perform an unsafe cast. If this cast fails, you'll get an exception, which so long as the ConfigMap
is used only in tests, will result in either a failed or canceled test or aborted suite. To give such exceptions nice stack depths and error messages, and to eliminate the need for using asInstanceOf
in your test code, ConfigMap
provides three methods for accessing values at expected types.
The getRequired
method returns the value bound to a key cast to a specified type, or throws TestCanceledException
if either the key is not bound or is bound to an incompatible type. Here's an example:
val tempFileName: String = configMap.getRequired[String]("tempFileName")
The getOptional
method returns the value bound to a key cast to a specified type, wrapped in a Some
, returns None
if the key is not bound, or throws TestCanceledException if the key exists but is bound to an incompatible type. Here's an example:
val tempFileName: Option[String] = configMap.getOptional[String]("tempFileName")
The getWithDefault
method returns the value bound to a key cast to a specified type, returns a specified default value if the key is not bound, or throws TestCanceledException if the key exists but is either not bound or is bound to an incompatible type. Here's an example:
val tempFileName: String = configMap.getWithDefault[String]("tempFileName", "tmp.txt")
Value parameters
- underlying
-
an immutable
Map
that holds the key/value pairs contained in thisConfigMap
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Map[String, Any]trait MapOps[String, Any, Map, Map[String, Any]]trait Map[String, Any]trait Equalstrait MapFactoryDefaults[String, Any, Map, Iterable]trait MapOps[String, Any, Map, Map[String, Any]]trait PartialFunction[String, Any]trait String => Anytrait Iterable[(String, Any)]trait Iterable[(String, Any)]trait IterableFactoryDefaults[(String, Any), Iterable]trait IterableOps[(String, Any), Iterable, Map[String, Any]]trait IterableOnceOps[(String, Any), Iterable, Map[String, Any]]trait IterableOnce[(String, Any)]class Objecttrait Matchableclass AnyShow all
Members list
Type members
Inherited classlikes
Attributes
- Inherited from:
- MapOps
- Supertypes
-
trait DefaultSerializabletrait Serializableclass AbstractSet[K]trait Set[K]trait SetOps[K, Set, Set[K]]trait Iterable[K]class AbstractSet[K]trait Set[K]trait Equalstrait SetOps[K, Set, Set[K]]trait K => Booleanclass AbstractIterable[K]trait Iterable[K]trait IterableFactoryDefaults[K, Set]trait IterableOps[K, Set, Set[K]]trait IterableOnceOps[K, Set, Set[K]]trait IterableOnce[K]class Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableFactoryDefaults -> IterableOps
Returns the value bound to a key cast to a specified type, wrapped in a Some
, returns None
if the key is not bound, or throws TestCanceledException if the key exists but is bound to an incompatible type. Here's an example:
Returns the value bound to a key cast to a specified type, wrapped in a Some
, returns None
if the key is not bound, or throws TestCanceledException if the key exists but is bound to an incompatible type. Here's an example:
val tempFileName: Option[String] = configMap.getOptional[String]("tempFileName")
Value parameters
- classTag
-
an implicit
ClassTag
specifying the expected type for the desired value - key
-
the key with which the desired value should be associated
Attributes
Returns the value bound to a key cast to the specified type V
, or throws TestCanceledException
if either the key is not bound or is bound to an incompatible type. Here's an example:
Returns the value bound to a key cast to the specified type V
, or throws TestCanceledException
if either the key is not bound or is bound to an incompatible type. Here's an example:
val tempFileName: String = configMap.getRequired[String]("tempFileName")
Value parameters
- classTag
-
an implicit
ClassTag
specifying the expected type for the desired value - key
-
the key with which the desired value should be associated
Attributes
Returns the value bound to a key cast to the specified type V
, returns a specified default value if the key is not bound, or throws TestCanceledException if the key exists but is if either the key is not bound or is bound to an incompatible type. Here's an example:
Returns the value bound to a key cast to the specified type V
, returns a specified default value if the key is not bound, or throws TestCanceledException if the key exists but is if either the key is not bound or is bound to an incompatible type. Here's an example:
val tempFileName: String = configMap.getWithDefault[String]("tempFileName", "tmp.txt")
Value parameters
- classTag
-
an implicit
ClassTag
specifying the expected type for the desired value - default
-
a default value to return if the key is not found
- key
-
the key with which the desired value should be associated
Attributes
Inherited methods
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapOps -> MapOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
MapOps -> IterableOnceOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
PartialFunction -> Function1
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapOps -> PartialFunction
- Inherited from:
- MapOps
Attributes
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- Function1
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- PartialFunction
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance
x
of typeAny
,x.equals(x)
should returntrue
. - It is symmetric: for any instances
x
andy
of typeAny
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any instances
x
,y
, andz
of typeAny
ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)
).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
true
if the receiver object is equivalent to the argument;false
otherwise. - Definition Classes
-
Map -> Equals -> Any
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Calculate a hash code value for the object.
Calculate a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)
) yet not be equal (o1.equals(o2)
returns false
). A degenerate implementation could always return 0
. However, it is required that if two objects are equal (o1.equals(o2)
returns true
) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)
). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals
method.
Attributes
- Returns
-
the hash code value for this object.
- Definition Classes
-
Map -> Any
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
Iterable -> Iterable -> IterableOps
- Inherited from:
- Iterable
Attributes
- Definition Classes
-
MapOps -> MapOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnce
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- Iterable
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
Map -> Map -> MapOps
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnce
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
Map -> IterableOnceOps
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Map -> Function1 -> Iterable -> Any
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapOps -> IterableOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- Map
Attributes
- Inherited from:
- Map
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Deprecated and Inherited methods
Attributes
- Deprecated
-
[Since version 2.13.0]
Use ++ with an explicit collection argument instead of + with varargs - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use ++ instead of ++: for collections of type Iterable - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use ++ instead of ++: for collections of type Iterable - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use -- with an explicit collection - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use foldLeft instead of /: - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use foldRight instead of :\\ - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
`aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead. - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use iterableFactory instead - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use `dest ++= coll` instead - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.filterKeys(f). A future version will include a strict version of this method (for now, .view.filterKeys(p).toMap). - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details) - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.mapValues(f). A future version will include a strict version of this method (for now, .view.mapValues(f).toMap). - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use coll instead of repr in a collection implementation, use the collection value itself from the outside - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Iterable.seq always returns the iterable itself - Inherited from:
- Iterable
Attributes
- Deprecated
-
[Since version 2.13.7]
toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections - Inherited from:
- Iterable
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .iterator instead of .toIterator - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .to(LazyList) instead of .toStream - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.slice(from, until) instead of .view(from, until) - Inherited from:
- IterableOps