This method enables the following syntax:
This method enables the following syntax:
set should not have (size (3))
^
This reason ResultOfSizeWordApplication
is a HavePropertyMatcher[AnyRef, Long]
is
so that you don't have to remember whether size
needs to be surrounded by parentheses when following
have
. Only length
and size
can be used without parentheses: everything else
needs the parentheses. So this approach means that if you use the unneeded parentheses with length
and
size
, it will still work. This apply
method uses reflection to find and access the size
property on the passed objectWithProperty
. Therefore if the object does not have the appropriate structure, the expression
will compile, but at will produce a TestFailedException
at runtime.
the object with the property against which to match
the HavePropertyMatchResult
that represents the result of the match
Compose this HavePropertyMatcher
with the passed function, returning a new HavePropertyMatcher
.
Compose this HavePropertyMatcher
with the passed function, returning a new HavePropertyMatcher
.
This method overrides compose
on Function1
to
return a more specific function type of HavePropertyMatcher
.
This class is part of the ScalaTest matchers DSL. Please see the documentation for
ShouldMatchers
orMustMatchers
for an overview of the matchers DSL.