Validatable
Instantiates a Validatable with a value, allowing to test custom constraints.
Usage example:
fun Validatable<String>.hasWordCountGreaterThan(count: Int) =
constrain { it.split(" ").size count }
@Test
fun testWordCount() {
assertFalse(Validatable("one two").hasWordCountGreaterThan(2).satisfied)
assertTrue(Validatable("one two three").hasWordCountGreaterThan(2).satisfied)
}
Content copied to clipboard