Factory method that creates a HavePropertyMatcher[T] from a
passed function of type (T => HavePropertyMatchResult).
Factory method that creates a HavePropertyMatcher[T] from a
passed function of type (T => HavePropertyMatchResult).
This allows you to create a HavePropertyMatcher in a slightly
more concise way, for example:
case class Person(name: String)
def name(expectedName: String) = {
HavePropertyMatcher {
(person: Person) => HavePropertyMatchResult(
person.name == expectedName,
"name",
expectedName,
person.name
)
}
Companion object for trait
HavePropertyMatcherthat provides a factory method that creates aHavePropertyMatcher[T]from a passed function of type(T => HavePropertyMatchResult).