a collection to wrap in a LoneElementCollectionWrapper
, which provides the loneElement
method.
a typeclass that enables the loneElement
syntax
Returns the value contained in the wrapped collection, if it contains one and only one element, else throws TestFailedException
with
a detail message describing the problem.
Returns the value contained in the wrapped collection, if it contains one and only one element, else throws TestFailedException
with
a detail message describing the problem.
This method enables syntax such as the following:
trav.loneElement should be > 9
^
Wrapper class that adds a
loneElement
method to any collection typeC
for which an implicitCollecting[C]
is available.Through the implicit conversion provided by trait
LoneElement
, this class allows you to make statements like:trav.loneElement should be > 9
the element type of the collection on which to add the
loneElement
methodthe "collection type constructor" for the collection on which to add the
loneElement
method