Matcher [A]가있는 경우 Matcher [Iterable [A]]를 만드는 방법은 각 요소 는 원래 Matcher를 만족시킵니다.사양 프레임 워크를 사용하는 Matcher [A]에서 Matcher [Iterable [A]]를 구성하는 방법
class ExampleSpec extends Specification {
def allSatisfy[A](m: => Matcher[A]): Matcher[Iterable[A]] = error("TODO")
def notAllSatisfy[A](m: => Matcher[A]): Matcher[Iterable[A]] = allSatisfy(m).not
"allSatisfy" should {
"Pass if all elements satisfy the expectation" in {
List(1, 2, 3, 4) must allSatisfy(beLessThan(5))
}
"Fail if any elements do not satisfy the expectation" in {
List(1, 2, 3, 5) must notAllSatisfy(beLessThan(5))
}
}
}
고마워, 그게 내가 찾고 있던 것 뿐이야. 나는 왜 내가 그것을 보지 않고 있는지 모른다. –