class
CheckingEqualizer[L] extends AnyRef
Instance Constructors
-
new
CheckingEqualizer(left: L)
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
def
!==(interval: Interval[L]): Boolean
-
def
!==[R](right: R)(implicit constraint: EqualityConstraint[L, R]): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
def
===(interval: Interval[L]): Boolean
-
def
===[R](right: R)(implicit constraint: EqualityConstraint[L, R]): Boolean
-
def
asAny: Any
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
Class used via an implicit conversion to enable any two objects to be compared with
===
in assertions in tests. For example:The benefit of using
assert(a === b)
rather thanassert(a == b)
is that aTestFailedException
produced by the former will include the values ofa
andb
in its detail message. The implicit method that performs the conversion fromAny
toEqualizer
isconvertToEqualizer
in traitAssertions
.In case you're not familiar with how implicit conversions work in Scala, here's a quick explanation. The
convertToEqualizer
method inAssertions
is defined as an "implicit" method that takes anAny
, which means you can pass in any object, and it will convert it to anEqualizer
. TheEqualizer
has===
defined. Most objects don't have===
defined as a method on them. Take two Strings, for example:Given this code, the Scala compiler looks for an
===
method on classString
, because that's the class of"hello"
.String
doesn't define===
, so the compiler looks for an implicit conversion fromString
to something that does have an===
method, and it finds theconvertToEqualizer
method. It then rewrites the code to this:So inside a
Suite
(which mixes inAssertions
,===
will work on anything. The only situation in which the implicit conversion wouldn't happen is on types that have an===
method already defined.The primary constructor takes one object,
left
, whose type is being converted toEqualizer
. Theleft
value may be anull
reference, because this is allowed by Scala's==
operator.