Lidonis Calhau
10/20/2021, 12:49 PMassertSoftly(foo) {
shouldNotEndWith("b")
length shouldBe 3
}
->
foo shouldBe customAssert
sam
10/20/2021, 12:59 PMLidonis Calhau
10/20/2021, 1:06 PMfun containFoo() = object : Matcher<String> {
override fun test(value: String) = MatcherResult(value.contains("foo"), "String $value should include foo", "String $value should not include foo")
}
sam
10/20/2021, 1:08 PMLidonis Calhau
10/20/2021, 1:09 PMsam
10/20/2021, 2:12 PMfun customAssert() = Matcher<String> { foo ->
val error = try {
assertSoftly(foo) {
shouldNotEndWith("b")
length shouldBe 3
}
null
} catch (e: Throwable) {
e
}
MatcherResult(error == null, "should not have failed", "should have failed")
}