Element¶
interface Element : TestConfig
An arbitrary configuration element.
Elements are grouped by their key. The number of elements allowed to exist in the config for a single key is controlled by the Uniqueness. To access an element in a TestConfig, see get.
Note that keys are not necessarily correlated with element types; an element type could split its instances between two different keys, in which case multiple elements of that type could be a part of the same config (but they would still differ by key).
Inheritors¶
Properties¶
coroutineContext¶
The coroutine context configured for this test through the Context configuration.
Note that this is different from the coroutine context actually used to run tests; the value returned by this method contains the context declared in the config, whereas more elements are injected by the test machinery when the test actually starts.
key¶
abstract val key: TestConfig.Key<*, *>
The identifier for this test configuration element.
Functions¶
get¶
operator fun <E : TestConfig.Element> TestConfig.get(key: TestConfig.Key<E, TestConfig.Uniqueness.Unique>): E?
Finds the Element identified by key in the current TestConfig.
It's not possible for multiple elements to share a key marked with Uniqueness.Unique, so this function can never return multiple results. However, no elements may be identified by a key, in which case null is returned.
operator fun <E : TestConfig.Element> TestConfig.get(key: TestConfig.Key<E, TestConfig.Uniqueness.Multi>): List<E>
Finds the elements identified by key in the current TestConfig.
Keys marked with Uniqueness.Multi allow multiple elements of the same type, so this function returns a list. If no elements are found, the returned list is empty.
plus¶
operator fun TestConfig.plus(other: TestConfig): TestConfig
Combines two TestConfig instances.
The elements of other always override or combine with the elements with the same key from the receiver (depending on the Key.uniqueness).