final class LoneElementCollectionWrapper[E, CTC[_]] extends AnyRef
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
- E
the element type of the collection on which to add the
loneElement
method- CTC
the "collection type constructor" for the collection on which to add the
loneElement
method
- Source
- LoneElement.scala
- Alphabetic
- By Inheritance
- LoneElementCollectionWrapper
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
LoneElementCollectionWrapper(collection: CTC[E], collecting: Collecting[E, CTC[E]], prettifier: Prettifier, pos: Position)
- collection
a collection to wrap in a
LoneElementCollectionWrapper
, which provides theloneElement
method.- collecting
a typeclass that enables the
loneElement
syntax
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
loneElement: E
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 ^
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )