org.specs2

matcher

package matcher

Visibility
  1. Public
  2. All

Type Members

  1. trait AdaptableMatcher[T] extends Matcher[T]

    Inherit this trait to provide a Matcher where both the actual and the expected values can be adapted with a function.

  2. case class AlwaysMatcher[T]() extends Matcher[T] with Product with Serializable

    This matcher always matches any value of type T

  3. class AndMatch[T] extends MatchResult[T]

  4. class AndNotMatch[T] extends MatchResult[T]

  5. trait AnyBeHaveMatchers extends AnyRef

    This trait allows to write expressions like

    This trait allows to write expressions like

    1 must be equalTo(1)

  6. trait AnyMatchers extends AnyBaseMatchers with AnyBeHaveMatchers

    This trait provides matchers which are applicable to any type of value

  7. class BeCloseTo[T] extends Matcher[T]

  8. class BeEqualTo extends BeTypedEqualTo[Any]

    Equality Matcher

  9. case class BeEqualTypedValueCheck[T](expected: T) extends ValueCheck[T] with Product with Serializable

    ValueCheck for a typed expected value.

    ValueCheck for a typed expected value. It uses the BeTypedEqualTo matcher

  10. case class BeEqualValueCheck[T](expected: Any) extends ValueCheck[T] with Product with Serializable

    ValueCheck for an untyped expected value.

    ValueCheck for an untyped expected value. It uses the BeEqualTo matcher

  11. class BeLessThan[T] extends Matcher[T]

  12. class BeLessThanOrEqualTo[T] extends Matcher[T]

  13. class BeMatching extends Matcher[String]

    Attributes
    protected[org.specs2]
  14. class BeMatchingPattern extends BeMatching

    Attributes
    protected[org.specs2]
  15. class BeMatchingRegex extends BeMatching

  16. class BeNull[T] extends Matcher[T]

  17. case class BeOneOf[T](t: Seq[T]) extends Matcher[T] with Product with Serializable

  18. class BeTheSameAs[T <: AnyRef] extends Matcher[T]

  19. class BeTrueMatcher extends Matcher[Boolean]

    Matcher for a boolean value which must be true

  20. class BeTypedEqualTo[T] extends AdaptableMatcher[T]

    Typed equality Matcher

  21. case class BetweenMatcher[T](t1: T, t2: T, includeStart: Boolean = true, includeEnd: Boolean = true)(implicit evidence$42: (T) ⇒ Ordered[T]) extends Matcher[T] with Product with Serializable

  22. trait CanBeEqual extends AnyRef

    This trait adds some implicits to create expectations with the === sign

  23. trait ConcurrentExecutionContext extends AnyRef

    Specification of the execution context to be used for executing futures This can be overridden to pass in your own execution context

  24. case class ContainWithResult[T](check: ValueCheck[T], timesMin: Option[Times] = Some(1.times), timesMax: Option[Times] = None, checkAll: Boolean = true) extends Matcher[GenTraversableOnce[T]] with Product with Serializable

  25. case class ContainWithResultSeq[T](checks: Seq[ValueCheck[T]], containsAtLeast: Boolean = true, containsAtMost: Boolean = false, eachCheck: Boolean = false, checkOrder: Boolean = false, negate: Boolean = false) extends Matcher[GenTraversableOnce[T]] with Product with Serializable

  26. case class DataTable(titles: Seq[String], rows: Seq[DataTableRow]) extends Product with Serializable

  27. case class DataTableRow(cells: Seq[String], result: Result) extends Product with Serializable

  28. trait DataTables extends Expectations

    This trait provides implicit definitions and types to create DataTables.

    This trait provides implicit definitions and types to create DataTables.

    A DataTable has a header defining column names and rows holding values. It is possible to apply a function taking the row values and returning a MatchResult.

    A TableHeader is defined by separating the column names with '|': "a" | "b" | "c"

    A DataRow is defined by separating the row values with '!': 1 ! 2 ! 3

    Note that the '!' method can conflict with the creation of Examples when the value is a string. In that case it is possible to use the '!!! method to disambiguate:

    "1" !! "2" ! "3"

    In that case the first column of the header can also be defined with '||' for pure symmetry reasons:

    "a" || "b" | "c" "1" !! "2" ! "3"

    See also

    org.specs2.matcher.DataTablesSpec for examples

  29. case class Delta[S](n: S, delta: S) extends Product with Serializable

    class representing a numeric range

  30. trait EitherMatchers extends EitherBaseMatchers with EitherBeHaveMatchers

    Matchers for the Either datatype

  31. trait EventuallyMatchers extends EventuallyResults

    This trait adds the possibility to retry a given matcher until it succeeds.

    This trait adds the possibility to retry a given matcher until it succeeds.

    This was contributed by @robey (http://robey.lag.net)

  32. trait ExceptionMatchers extends ExceptionBaseMatchers with ExceptionBeHaveMatchers

    These matchers can be used to check if exceptions are thrown or not

  33. class Expectable[+T] extends AnyRef

    The Expectable class models anything which can be checked by applying a Matcher

    The Expectable class models anything which can be checked by applying a Matcher

    It stores a value which is only evaluated when necessary and an optional additional description for that value.

    The Expectable object is responsible for creating its own description, based on the value toString method and and an additional description.

  34. trait Expectations extends CanBeEqual

    This trait provides implicit definitions to transform any value into an Expectable

  35. trait ExpectationsDescription extends Sentences with Expectations

  36. trait FutureMatchers extends Expectations with ConcurrentExecutionContext

    This trait is for transforming matchers of values to matchers of Futures

  37. case class LeftCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[[a]Either[a, _], T, T] with Product with Serializable

  38. case class LeftMatcher[T]() extends OptionLikeMatcher[[a]Either[a, _], T, T] with Product with Serializable

  39. trait MapMatchers extends MapBaseMatchers with MapBeHaveMatchers

    Matchers for Maps

  40. case class MatchFailure[T] extends MatchResult[T] with Product with Serializable

  41. class MatchFailureException[T] extends FailureException with MatchResultException[T]

    this class allows to throw a match failure result in an Exception

  42. case class MatchPending[T] extends MatchResult[T] with Product with Serializable

  43. class MatchPendingException[T] extends PendingException with MatchResultException[T]

    this class allows to throw a pending result in an Exception

  44. trait MatchResult[+T] extends ResultLike

    Result of a Match.

    Result of a Match.

    A MatchResult contains several information about a match on an expectable:

    - the expectable value, to allow the chaining of matches - a pair of messages ok message / ko message to allow the easy creation of the negation of a match

    A MatchResult can be transformed to a simple Result object to be the body of an Example.

    There are different kinds of MatchResults, some of them being only created to support English-like combination of Matchers:

    1 must be equalTo(1) and not be equalTo(2)

    In an Expectation like the one above, there is a left to right evaluation:

    1. be is a NeutralMatcher, returning a NeutralMatch doing nothing yet, just storing the expectable

    2. equalTo(1) is a real Matcher which is applied to the NeutralMatch MatchResult thanks to an implicit definition in the BeHaveAnyMatchers trait. This yields a MatchSuccess result

    3. not creates a NotMatcher and can be and-ed with the previous MatchSuccess to yield a AndMatch(MatchSuccess, NotMatch), with NotMatch being the result of applying the NotMatcher to the expectable. This AndMatch is evaluated to create a AndNotMatch(MatchSuccess, MatchSkip)

    Basically this is like forming an evaluation structure which will be resolved when the next 'real' matcher will arrive

    4. the AndNotMatch get nows it be method called with the equalTo Matcher. This results in equalTo being applied to the AndNotMatch, effectively doing: MatchSuccess and MatchSkip.apply(equalTo(2).not), which is MatchSuccess and expectable.applyMatcher(equalTo(2).not) which is MatchSuccess

    See also

    org.specs2.matcher.BeHaveMatchersSpec for examples

  45. trait MatchResultException[T] extends AnyRef

  46. case class MatchSkip[T] extends MatchResult[T] with Product with Serializable

  47. class MatchSkipException[T] extends SkipException with MatchResultException[T]

    this class allows to throw a skipped match result in an Exception

  48. case class MatchSuccess[T] extends MatchResult[T] with Product with Serializable

    The signature of this class constructor is unusual, with a useless implicit parameter.

    The signature of this class constructor is unusual, with a useless implicit parameter.

    This is actually here to avoid overloading conflicts with the apply method in the companion object

  49. trait Matcher[-T] extends AnyRef

    The Matcher trait is the base trait for any Matcher.

    The Matcher trait is the base trait for any Matcher.

    This trait can be extended to provide an appropriate apply method that will check an expectable value a: Expectable[T].

    The result of a match is a MatchResult object (@see MatchResult).

    Matchers can be composed.

    Implementation notes:

    • the parameter to the apply method must be a by-name parameter. This allows some values to be evaluated only when necessary.
    • However in the implementation of the apply function, it must be taken care of not evaluating the parameter twice. Assigning it to a val is the solution to this issue.
  50. trait MatcherZipOperators extends Expectations with ValueChecks

    This trait provides 'zip' operators to create matchers on tuples based on "zipped" matchers on fields

  51. trait MatcherZipOperatorsCodeGeneration extends AnyRef

    Generation code for the MatcherZipOperators trait

  52. trait Matchers extends AnyMatchers with BeHaveMatchers with TraversableMatchers with MapMatchers with StringMatchers with ExceptionMatchers with NumericMatchers with OptionMatchers with EitherMatchers with TryMatchers with EventuallyMatchers with FutureMatchers with MatchersImplicits with LanguageFeatures

    Trait aggregating the most common specs2 matchers

  53. trait MatchersImplicits extends Expectations with MatchResultCombinators with MatcherZipOperators with MatchResultImplicits with ExpectationsDescription

    This trait provides implicit definitions from MatchResults and Booleans to Results.

    This trait provides implicit definitions from MatchResults and Booleans to Results.

    It also allows to:

    - create matchers from functions - create matchers for seqs and sets from single matchers

  54. class MustExpectable[T] extends Expectable[T]

    This kind of expectable can be followed by the verb must to apply a matcher:

    This kind of expectable can be followed by the verb must to apply a matcher:

    1 must beEqualTo(1)

    For convenience, several mustMatcher methods have also been defined as shortcuts to equivalent:

    a must matcher

  55. trait MustExpectations extends Expectations

    This trait provides implicit definitions to transform any value into a MustExpectable

  56. trait MustMatchers extends Matchers with MustExpectations

  57. trait MustThrownExpectations extends ThrownExpectations with MustExpectations

    This trait provides implicit definitions to transform any value into a MustExpectable, throwing exceptions when a match fails

  58. trait MustThrownMatchers extends Matchers with MustThrownExpectations

  59. case class NeutralMatch[T] extends MatchResult[T] with Product with Serializable

  60. class NeutralMatcher[T] extends Matcher[T]

    This special matcher always return a NeutralMatch MatchResult (an implicit Success)

  61. case class NeverMatcher[T]() extends Matcher[T] with Product with Serializable

    This matcher never matches any value of type T

  62. trait NoCanBeEqual extends CanBeEqual

    This trait can be used to suppress the CanBeEqual implicits

  63. trait NoConcurrentExecutionContext extends ConcurrentExecutionContext

    stack this trait to remove the implicit execution context used to evaluate features

  64. trait NoExpectationsDescription extends ExpectationsDescription

  65. trait NoMatcherZipOperatorsImplicits extends MatcherZipOperators

    This trait can be mixed in to remove the implicit definitions for zipping matchers

  66. trait NoMatcherZipOperatorsImplicitsCodeGeneration extends AnyRef

    code generation for the NoMatcherZipOperatorsImplicits trait

  67. trait NoMustExpectations extends MustExpectations

    This trait can be used to remove aka and must methods on any value

  68. trait NoShouldExpectations extends ShouldExpectations

    This trait can be used to remove aka and should methods on any value

  69. trait NoThrownExpectations extends Expectations

    This trait can be used to cancel the effect of thrown expectations.

    This trait can be used to cancel the effect of thrown expectations.

    For example it can be mixed-in a mutable.Specification so that no exception is thrown on failure

  70. case class NotMatch[T] extends MatchResult[T] with Product with Serializable

  71. class NotMatcher[T] extends Matcher[T]

    This special matcher always return a NotMatch MatchResult.

    This special matcher always return a NotMatch MatchResult. It will negate the next match applied to it.

  72. trait NumericMatchers extends NumericBaseMatchers with NumericBeHaveMatchers

    Matchers for Numerical values

  73. class OptionLikeCheckedMatcher[F[_], T, U] extends Matcher[F[T]]

  74. class OptionLikeMatcher[F[_], T, U] extends Matcher[F[T]]

  75. trait OptionMatchers extends OptionBaseMatchers with OptionBeHaveMatchers

    Matchers for Options

  76. class OrMatch[T] extends MatchResult[T]

  77. class OrNotMatch[T] extends MatchResult[T]

  78. class OrderingMatcher[T] extends Matcher[Seq[T]]

  79. trait ResultMatchers extends ResultBaseMatchers with ResultBeHaveMatchers

    Matchers for Results

  80. case class RightCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[[a]Either[_, a], T, T] with Product with Serializable

  81. case class RightMatcher[T]() extends OptionLikeMatcher[[a]Either[_, a], T, T] with Product with Serializable

  82. trait Scope extends AnyRef

    This trait represents any Scope that is used to enclose expectations which might be thrown

  83. class ShouldExpectable[T] extends Expectable[T]

    This kind of expectable can be followed by the verb should to apply a matcher:

    This kind of expectable can be followed by the verb should to apply a matcher:

    1 should beEqualTo(1)

    For convenience, several shouldMatcher methods have also been defined as shortcuts to equivalent:

    a should matcher

  84. trait ShouldExpectations extends Expectations

    This trait provides implicit definitions to transform any value into a ShouldExpectable

  85. trait ShouldMatchers extends Matchers with ShouldExpectations

  86. trait ShouldThrownExpectations extends ThrownExpectations with ShouldExpectations

    This trait provides implicit definitions to transform any value into a ShouldExpectable, throwing exceptions when a match fails

  87. trait ShouldThrownMatchers extends Matchers with ShouldThrownExpectations

  88. class SizedMatcher[T] extends Matcher[T]

  89. case class SomeCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[Option, T, T] with Product with Serializable

  90. case class SomeMatcher[T]() extends OptionLikeMatcher[Option, T, T] with Product with Serializable

  91. trait StandardMatchResults extends Expectations

    This trait can be used in conjonction with Pattern matchers:

    This trait can be used in conjonction with Pattern matchers:

    List(1, 2) must be like { case List(a, b) => ok } List(1, 2) must be like { case List(a, b) => ko("unexpected") }

  92. trait StoredExpectations extends Expectations

    This trait evaluates expectations and stores them in a local variable for further usage

  93. trait StringMatchers extends StringBaseMatchers with StringBeHaveMatchers

    The StringMatchers trait provides matchers which are applicable to String objects

  94. trait ThrownExpectations extends Expectations with StandardResults with StandardMatchResults

    Thrown expectations will throw a FailureException if a match fails

    Thrown expectations will throw a FailureException if a match fails

    This trait can be extended to be used in another framework like ScalaTest:

    trait ScalaTestExpectations extends ThrownExpectations { override protected def checkFailure[T](m: =>MatchResult[T]) = { m match { case f @ MatchFailure(ok, ko, _, _) => throw new TestFailedException(f.message, f.exception, 0) case _ => () } m } }

  95. trait ThrownMessages extends AnyRef

    This trait can be used to integrate failures and skip messages into specs2

  96. trait TraversableMatchers extends TraversableBaseMatchers with NumberOfTimes with TraversableBeHaveMatchers with LazyParameters

    Matchers for traversables

  97. case class TryFailureCheckedMatcher[T](check: ValueCheck[Throwable]) extends OptionLikeCheckedMatcher[Try, T, Throwable] with Product with Serializable

  98. case class TryFailureMatcher[T]() extends OptionLikeMatcher[Try, T, Throwable] with Product with Serializable

  99. trait TryMatchers extends TryBaseMatchers with TryBeHaveMatchers

    Matchers for util.Try instances

  100. case class TrySuccessCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[Try, T, T] with Product with Serializable

  101. case class TrySuccessMatcher[T]() extends OptionLikeMatcher[Try, T, T] with Product with Serializable

  102. trait ValueCheck[T] extends AnyRef

    Common interface for checks of a value of type T:

    Common interface for checks of a value of type T:

    • a expected single value of type T
    • a Matcher[T]
    • a function returning a type R having an AsResult instance
  103. trait ValueChecks extends ValueChecksLowImplicits

    implicit conversions used to create ValueChecks

  104. trait ValueChecksLowImplicits extends AnyRef

Value Members

  1. object AnyMatchers extends AnyMatchers

  2. object BeMatching

  3. object BestMatching

    Use of the Hopcroft-Karp (https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm) algorithm for specs2, to the minimum set of mismatched elements, and corresponding failures

  4. object DataTable extends Serializable

  5. object DataTableRow extends Serializable

  6. object EitherMatchers extends EitherMatchers

  7. object EventuallyMatchers extends EventuallyMatchers

  8. object ExceptionMatchers extends ExceptionMatchers

  9. object Expectable

    Factory methods for creating Expectables

  10. object FutureMatchers extends FutureMatchers

  11. object MapMatchers extends MapMatchers

  12. object MatchFailure extends Serializable

  13. object MatchFailureException extends Serializable

  14. object MatchPendingException extends Serializable

  15. object MatchResultCombinators extends MatchResultCombinators

  16. object MatchResultExecution extends MatchResultExecution

  17. object MatchResultLogicalCombinators extends MatchResultLogicalCombinators

  18. object MatchSkipException extends Serializable

  19. object MatchSuccess extends Serializable

  20. object Matcher

  21. object Matchers extends Matchers

  22. object MustExpectable

  23. object MustExpectations extends MustExpectations

  24. object MustMatchers extends MustMatchers

  25. object MustThrownExpectations extends MustThrownExpectations

  26. object MustThrownMatchers extends MustThrownMatchers

  27. object NumericMatchers extends NumericMatchers

  28. object OptionMatchers extends OptionMatchers

  29. object ResultMatchers extends ResultMatchers

  30. object Scope

  31. object ShouldExpectable

  32. object ShouldExpectations extends ShouldExpectations

  33. object ShouldMatchers extends ShouldMatchers

  34. object ShouldThrownExpectations extends ShouldThrownExpectations

  35. object ShouldThrownMatchers extends ShouldThrownMatchers

  36. object StandardMatchResults extends StandardMatchResults

  37. object StringMatchers extends StringMatchers

  38. object TraversableMatchers extends TraversableMatchers

  39. object TryMatchers extends TryMatchers

  40. object ValueCheck

  41. object ValueChecks extends ValueChecks

Ungrouped