Suite • opensavvy.prepared.suite.config • TestConfig
TestConfig¶
sealed interface TestConfig
Generic configuration description.
Configuration items are subclasses of Element
, each identified by a unique Key
. Complex configurations are created by combining simpler items using plus
. Accessing a specific item is done using get
.
How to create a new configuration option¶
Create a class that subclasses Element
with a companion object that subclasses Key
. You can store any data in this class.
class YourConfigurationOption : TestConfig.Element {
override val key get() = Companion
companion object : TestConfig.Key.Unique<YourConfigurationOption>
}
Inheritors¶
Types¶
Element
¶
interface Element : TestConfig
An arbitrary configuration element.
Empty
¶
object Empty : TestConfig
The empty TestConfig
, useful as a default parameter when no particular configuration is required.
Key
¶
interface Key<E : TestConfig.Element, U : TestConfig.Uniqueness>
Identifier of an Element
.
Uniqueness
¶
sealed class Uniqueness
Marker for the uniqueness of a TestConfig.Element
.
Properties¶
coroutineContext
¶
The coroutine context configured for this test through the Context
configuration.
Functions¶
get
¶
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
.
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
.
plus
¶
operator fun TestConfig.plus(other: TestConfig): TestConfig
Combines two TestConfig
instances.