Typeclass that enables for aggregations certain contain syntax in the ScalaTest matchers DSL.
Typeclass that enables for aggregations certain contain syntax in the ScalaTest matchers DSL.
An Aggregating[A] provides access to the "aggregating nature" of type A in such
a way that relevant contain matcher syntax can be used with type A. An A
can be any type of aggregation—an object that in some way aggregates or brings together other objects. ScalaTest provides
implicit implementations for several types out of the box in the
Aggregating companion object:
scala.collection.GenTraversableStringArrayjava.util.Collectionjava.util.MapThe contain syntax enabled by this trait is:
result should contain atLeastOneOf (1, 2, 3)result should contain atMostOneOf (1, 2, 3)result should contain only (1, 2, 3)result should contain allOf (1, 2, 3)result should contain theSameElementsAs (List(1, 2, 3))You can enable the contain matcher syntax enabled by Aggregating on your own
type U by defining an Aggregating[U] for the type and making it available implicitly.
Note, for an explanation of the difference between Containing and Aggregating, both of which
enable contain matcher syntax, see the Containing
versus Aggregating section of the main documentation for trait Containing.
Supertrait for typeclasses that enable certain contain matcher syntax for containers.
Supertrait for typeclasses that enable certain contain matcher syntax for containers.
A Containing[C] provides access to the "containing nature" of type C in such
a way that relevant contain matcher syntax can be used with type C. A C
can be any type of "container," a type that in some way can contains one or more other objects. ScalaTest provides
implicit implementations for several types. You can enable the contain matcher syntax on your own
type U by defining an Containing[U] for the type and making it available implicitly.
ScalaTest provides implicit Containing instances for scala.collection.GenTraversable,
java.util.Collection, java.util.Map, String, Array,
and scala.Option in the Containing companion object.
Containing versus Aggregating The difference between Containing and Aggregating is that
Containing enables contain matcher syntax that makes sense for "box" types that can
contain at most one value (for example, scala.Option),
whereas Aggregating enables contain matcher syntax for full-blown collections and other
aggregations of potentially more than one object. For example, it makes sense to make assertions like these, which
are enabled by Containing, for scala.Option:
val option: Option[Int] = Some(7) option should contain (7) option should contain oneOf (6, 7, 8) option should contain noneOf (3, 4, 5)
However, given a scala.Option can only ever contain at most one object, it doesn't make
sense to make assertions like the following, which are enabled via Aggregation:
// Could never succeed, so does not compile option should contain allOf (6, 7, 8)
The above assertion could never succceed, because an option cannot contain more than
one value. By default the above statement does not compile, because contain allOf
is enabled by Aggregating, and ScalaTest provides no implicit Aggregating instance
for type scala.Option.
Supertrait for typeclasses that enable contain key matcher syntax.
Supertrait for typeclasses that enable contain key matcher syntax.
A KeyMapping[M] provides access to the "key mapping nature" of type M in such
a way that contain key matcher syntax can be used with type M. A M
can be any type for which contain key syntax makes sense. ScalaTest provides implicit implementations
for scala.collection.GenMap and java.util.Map. You can enable the contain key
matcher syntax on your own type U by defining a KeyMapping[U] for the type and making it
available implicitly.
ScalaTest provides implicit KeyMapping instances for scala.collection.GenMap,
and java.util.Map in the KeyMapping companion object.
Typeclass that enables for sequencing certain contain syntax in the ScalaTest matchers DSL.
Typeclass that enables for sequencing certain contain syntax in the ScalaTest matchers DSL.
An Sequencing[A] provides access to the "sequenching nature" of type A in such
a way that relevant contain matcher syntax can be used with type A. An A
can be any type of sequencing—an object that in some way brings together other objects in order.
ScalaTest provides implicit implementations for several types out of the box in the
Sequencing companion object:
scala.collection.GenSeqscala.collection.SortedSetscala.collection.SortedMapArrayjava.util.Listjava.util.SortedSetjava.util.SortedMapStringThe contain syntax enabled by this trait is:
result should contain inOrder (1, 2, 3)result should contain inOrderOnly (1, 2, 3)result should contain theSameElementsInOrderAs List(1, 2, 3)You can enable the contain matcher syntax enabled by Sequencing on your own
type U by defining an Sequencing[U] for the type and making it available implicitly.
Supertrait for typeclasses that enable contain value matcher syntax.
Supertrait for typeclasses that enable contain value matcher syntax.
A ValueMapping[M] provides access to the "value mapping nature" of type M in such
a way that contain value matcher syntax can be used with type M. An M
can be any type for which contain value syntax makes sense. ScalaTest provides implicit implementations
for scala.collection.GenMap and java.util.Map. You can enable the contain value
matcher syntax on your own type U by defining a ValueMapping[U] for the type and making it
available implicitly.
ScalaTest provides implicit ValueMapping instances for scala.collection.GenMap,
and java.util.Map in the ValueMapping companion object.
Please use org.scalactic.enablers.Collecting instead.
Please use org.scalactic.enablers.Definition instead.
Please use org.scalactic.enablers.Emptiness instead.
Please use org.scalactic.enablers.Existence instead.
Please use org.scalactic.enablers.Length instead.
Please use org.scalactic.enablers.Messaging instead.
Please use org.scalactic.enablers.Readability instead.
Please use org.scalactic.enablers.Size instead.
Please use org.scalactic.enablers.Sortable instead.
Please use org.scalactic.enablers.Writability instead.
Companion object for Aggregating that provides implicit implementations for the following types:
Companion object for Aggregating that provides implicit implementations for the following types:
scala.collection.GenTraversableStringArrayjava.util.Collectionjava.util.Map
Companion object for Containing that provides implicit implementations for the following types:
Companion object for Containing that provides implicit implementations for the following types:
scala.collection.GenTraversableStringArrayscala.Optionjava.util.Collectionjava.util.Map
Companion object for KeyMapping that provides implicit implementations for scala.collection.GenMap and java.util.Map.
Companion object for KeyMapping that provides implicit implementations for scala.collection.GenMap and java.util.Map.
Companion object for Sequencing that provides implicit implementations for the following types:
Companion object for Sequencing that provides implicit implementations for the following types:
scala.collection.GenSeqscala.collection.SortedSetscala.collection.SortedMapArrayjava.util.Listjava.util.SortedSetjava.util.SortedMapString
Companion object for ValueMapping that provides implicit implementations for scala.collection.GenMap and java.util.Map.
Companion object for ValueMapping that provides implicit implementations for scala.collection.GenMap and java.util.Map.