org.scalatest

enablers

package enablers

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. enablers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait Aggregating[-A] extends AnyRef

    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.GenTraversable
    • String
    • Array
    • java.util.Collection
    • java.util.Map

    The 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.

  2. trait Containing[-C] extends AnyRef

    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.

  3. type EvidenceThat[T] = scalactic.enablers.EvidenceThat[T]

  4. trait KeyMapping[-M] extends AnyRef

    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.

  5. trait Sequencing[-S] extends AnyRef

    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.GenSeq
    • scala.collection.SortedSet
    • scala.collection.SortedMap
    • Array
    • java.util.List
    • java.util.SortedSet
    • java.util.SortedMap
    • String

    The 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.

  6. trait ValueMapping[-M] extends AnyRef

    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.

  7. type Collecting[E, C] = scalactic.enablers.Collecting[E, C]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Collecting instead.

  8. type Definition[-T] = scalactic.enablers.Definition[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Definition instead.

  9. type Emptiness[-T] = scalactic.enablers.Emptiness[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Emptiness instead.

  10. type Existence[-S] = scalactic.enablers.Existence[S]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Existence instead.

  11. type Length[T] = scalactic.enablers.Length[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Length instead.

  12. type Messaging[T] = scalactic.enablers.Messaging[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Messaging instead.

  13. type Readability[-T] = scalactic.enablers.Readability[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Readability instead.

  14. type Size[T] = scalactic.enablers.Size[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Size instead.

  15. type Sortable[-S] = scalactic.enablers.Sortable[S]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Sortable instead.

  16. type Writability[-T] = scalactic.enablers.Writability[T]

    Annotations
    @deprecated
    Deprecated

    Please use org.scalactic.enablers.Writability instead.

Value Members

  1. object Aggregating

    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.GenTraversable
    • String
    • Array
    • java.util.Collection
    • java.util.Map
  2. object Containing

    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.GenTraversable
    • String
    • Array
    • scala.Option
    • java.util.Collection
    • java.util.Map
  3. object KeyMapping

    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.

  4. object Sequencing

    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.GenSeq
    • scala.collection.SortedSet
    • scala.collection.SortedMap
    • Array
    • java.util.List
    • java.util.SortedSet
    • java.util.SortedMap
    • String
  5. object ValueMapping

    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.

Inherited from AnyRef

Inherited from Any

Ungrouped