LoneElementCollectionWrapper
Wrapper class that adds a loneElement method to any collection type C for which
an implicit Collecting[C] is available.
Through the implicit conversion provided by trait LoneElement, this class allows you to make statements like:
trav.loneElement should be > 9
- Type parameters:
- CTC
the "collection type constructor" for the collection on which to add the
loneElementmethod- E
the element type of the collection on which to add the
loneElementmethod
- Value parameters:
- collecting
a typeclass that enables the
loneElementsyntax- collection
a collection to wrap in a
LoneElementCollectionWrapper, which provides theloneElementmethod.
Value members
Concrete methods
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
^