HavePropertyMatcher

Companion object for trait HavePropertyMatcher that provides a factory method that creates a HavePropertyMatcher[T] from a passed function of type (T => HavePropertyMatchResult).

Companion:
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[T, P](fun: T => HavePropertyMatchResult[P])(implicit evT: ClassTag[T], evP: ClassTag[P]): HavePropertyMatcher[T, P]

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
    )
  }