enumTests
fun <InternalValue, E : Enum<E>> enumTests(describeName: String = "fromValueOrNull", dataNameFn: (Map.Entry<EnumMapEntry<InternalValue>, E>) -> String = { "${it.key.propertyName}: ${it.value}" }, enumValuesMap: Map<EnumMapEntry<InternalValue>, E>, fromValueOrNullFn: (InternalValue) -> E?, invalidArb: Arb<InternalValue>): TestFactory(source)
Test factory to create tests for the given enum.
Since
0.1.0
Parameters
InternalValue
The internal value representation.
E
The enum.
describeName
Descriptive name to be passed to the top-level describe()
function.
dataNameFn
Function to be used for withData's nameFn
.
enumValuesMap
The map of internal values to their enum representation.
fromValueOrNullFn
Function used to convert the internal value to its enum representation.
invalidArb
Arbitrary used to output invalid internal values. This is used to test that the invalid values from this arbitrary returns null
from fromValueOrNullFn.