org.specs2.matcher

Members list

Packages

Type members

Classlikes

trait ActionMatchers extends ValueChecks

Matchers for Action values

Matchers for Action values

Attributes

Companion
object
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Self type
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.

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

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
Known subtypes
class EqualityMatcher[T]
class BeEqualTo
Self type
case class AlwaysMatcher[T]() extends Matcher[T]

This matcher always matches any value of type T

This matcher always matches any value of type T

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[T]
class Object
trait Matchable
class Any
Show all
trait AnyMatchers

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

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AnyMatchers extends AnyMatchers

Attributes

Companion
trait
Supertypes
trait AnyMatchers
class Object
trait Matchable
class Any
Self type
class BeCloseTo[T](n: T, delta: T)(using evidence$1: Numeric[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class BeEqualTo(t: => Any) extends EqualityMatcher[Any]

Equality Matcher

Equality Matcher

Attributes

Supertypes
class EqualityMatcher[Any]
trait AdaptableMatcher[Any]
trait Matcher[Any]
class Object
trait Matchable
class Any
Show all
case class BeEqualTypedValueCheck[T](expected: T)(using evidence$1: Diffable[T]) extends ValueCheck[T]

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

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

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait ValueCheck[T]
class Object
trait Matchable
class Any
Show all
case class BeEqualValueCheck[T](expected: Any) extends ValueCheck[T]

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

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

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait ValueCheck[T]
class Object
trait Matchable
class Any
Show all
class BeFalseMatcher extends Matcher[Boolean]

Matcher for a boolean value which must be true

Matcher for a boolean value which must be true

Attributes

Supertypes
trait Matcher[Boolean]
class Object
trait Matchable
class Any
class BeGreaterThan[T](n: T)(using evidence$1: Ordering[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class BeGreaterThanOrEqualTo[T](n: T)(using evidence$1: Ordering[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class BeLessThan[T](n: T)(using evidence$1: Ordering[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class BeLessThanOrEqualTo[T](n: T)(using evidence$1: Ordering[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
object BeMatching extends StringMatchers

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
BeMatching.type
class BeNull[T] extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
case class BeOneOf[T](t: Seq[T]) extends Matcher[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[T]
class Object
trait Matchable
class Any
Show all
class BeSignificantlyCloseTo[T](target: T, sf: SignificantFigures)(using evidence$1: Numeric[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class BeTheSameAs[T <: AnyRef](t: => T) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class BeTrueMatcher extends Matcher[Boolean]

Matcher for a boolean value which must be true

Matcher for a boolean value which must be true

Attributes

Supertypes
trait Matcher[Boolean]
class Object
trait Matchable
class Any
case class BetweenMatcher[T](t1: T, t2: T, includeStart: Boolean = ..., includeEnd: Boolean = ...)(using evidence$1: Ordering[T]) extends Matcher[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[T]
class Object
trait Matchable
class Any
Show all
case class CanHaveDelta[S](n: S)(using evidence$1: Numeric[S])

transient class allowing the creation of a delta

transient class allowing the creation of a delta

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Checker

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Checker

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Checker.type
case class ContainWithResult[T](check: ValueCheck[T], timesMin: Option[Times] = ..., timesMax: Option[Times] = ..., checkAll: Boolean = ..., negate: Boolean = ...) extends Matcher[Iterable[T]]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[Iterable[T]]
class Object
trait Matchable
class Any
Show all
case class ContainWithResultSeq[T](checks: Seq[ValueCheck[T]], containsAtLeast: Boolean = ..., containsAtMost: Boolean = ..., eachCheck: Boolean = ..., checkOrder: Boolean = ..., negate: Boolean = ...) extends Matcher[Iterable[T]]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[Iterable[T]]
class Object
trait Matchable
class Any
Show all

The ContentMatchers trait provides matchers to make comparisons between files, sequences,...

The ContentMatchers trait provides matchers to make comparisons between files, sequences,...

Attributes

Companion
object
Supertypes
Known subtypes

Attributes

Companion
trait
Supertypes
Self type
case class DataTable(titles: Seq[String], rows: Seq[DataTableRow])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object DataTable

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
DataTable.type
case class DataTableRow(cells: Seq[String], result: Result)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object DataTableRow

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

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

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"

Attributes

See also

org.specs2.matcher.DataTablesSpec for examples

Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Tables
trait Tables
object Tables

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Matchers for the Either datatype

Matchers for the Either datatype

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
class EqualIgnoringSpaceMatcher(node: Seq[Node]) extends Matcher[Seq[Node]], XmlMatcherKoMessage

Matcher for equalIgnoreSpace comparison, ignoring the nodes order

Matcher for equalIgnoreSpace comparison, ignoring the nodes order

Attributes

Supertypes
trait Matcher[Seq[Node]]
class Object
trait Matchable
class Any
class EqualIgnoringSpaceMatcherOrdered(node: Seq[Node]) extends Matcher[Seq[Node]], XmlMatcherKoMessage

Matcher for equalIgnoreSpace comparison, considering the node order

Matcher for equalIgnoreSpace comparison, considering the node order

Attributes

Supertypes
trait Matcher[Seq[Node]]
class Object
trait Matchable
class Any
class EqualityMatcher[T](t: => T)(using evidence$1: Diffable[T]) extends AdaptableMatcher[T]

Attributes

Supertypes
trait AdaptableMatcher[T]
trait Matcher[T]
class Object
trait Matchable
class Any
Known subtypes
class BeEqualTo
Self type

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)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

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

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

Attributes

Companion
object
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type
case class Expectable[+T]

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.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
object Expectable

Factory methods for creating Expectables

Factory methods for creating Expectables

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Expectable.type

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

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

Attributes

Companion
object
Supertypes
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes
object Expectations extends Expectations

Attributes

Companion
trait
Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type

Base trait to create expectations.

Base trait to create expectations.

An expectation is a value which can have an optional description and which can be matched to produce a result (for example against an expected value)

When a result is produced it can possibly be thrown as an exception based on the behaviour of the ResultChecks trait

Attributes

Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Known subtypes
trait DataTables
trait Tables
trait Tables
object Tables
trait Matchers
object Matchers
trait MustMatchers
object MustMatchers
trait Card
trait SpecLike
class Spec
trait SpecLike
class Spec
trait SpecLike
class Spec
trait Expectations
object Expectations
trait JsonMatchers
object JsonMatchers
object ReturnsSyntax
object TypedEqual
trait AsResultProp
object AsResultProp
trait ScalaCheck
Show all

Attributes

Companion
object
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type

This trait can be used in conjunction with Pattern matchers:

This trait can be used in conjunction with Pattern matchers:

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

Attributes

Companion
object
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type
case class FailTypecheckMatcher(expected: String) extends Matcher[TypecheckResult]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait FileMatchers extends PathMatchers

The FileMatchers trait provides matchers which are applicable to files

The FileMatchers trait provides matchers which are applicable to files

Attributes

Companion
object
Supertypes
trait PathMatchers
class Object
trait Matchable
class Any
Known subtypes
object FileMatchers extends FileMatchers

Attributes

Companion
trait
Supertypes
trait FileMatchers
trait PathMatchers
class Object
trait Matchable
class Any
Self type

This trait provides matchers to check the presence of some expected files vs the actual ones and also ways to verify the contents of these files

This trait provides matchers to check the presence of some expected files vs the actual ones and also ways to verify the contents of these files

Attributes

Supertypes
Known subtypes
trait FutureMatcher[-T]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object FutureMatcher

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

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

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

Attributes

Companion
object
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type
trait Hamcrest

This trait adds implicit conversions to be able to use Hamcrest matchers as specs2 matchers.

This trait adds implicit conversions to be able to use Hamcrest matchers as specs2 matchers.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Hamcrest
object Hamcrest extends Hamcrest

Attributes

Companion
trait
Supertypes
trait Hamcrest
class Object
trait Matchable
class Any
Self type
Hamcrest.type

This trait throws AssertionFailed errors when a match fails.

This trait throws AssertionFailed errors when a match fails.

It is involved when reusing Matchers with JUnit

Attributes

Supertypes
Known subtypes

This trait can be imported to use MustMatchers in JUnit

This trait can be imported to use MustMatchers in JUnit

Attributes

Companion
object
Supertypes
Known subtypes

These traits and objects can be used in JUnit

These traits and objects can be used in JUnit

Attributes

Companion
object
Supertypes
Known subtypes

This trait can be imported to use ShouldMatchers in JUnit

This trait can be imported to use ShouldMatchers in JUnit

Attributes

Companion
object
Supertypes
Known subtypes
case class JsonArray(list: List[Any]) extends JsonType

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait JsonType
class Object
trait Matchable
class Any
Show all
case class JsonBoolean(b: Boolean) extends JsonType

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait JsonType
class Object
trait Matchable
class Any
Show all
case class JsonMap(map: Map[String, Any]) extends JsonType

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait JsonType
class Object
trait Matchable
class Any
Show all
trait JsonMatchers extends Expectations

Matchers for Json expressions (entered as strings)

Matchers for Json expressions (entered as strings)

Attributes

Companion
object
Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes
object JsonMatchers
Self type
object JsonMatchers extends JsonMatchers

Attributes

Companion
trait
Supertypes
trait JsonMatchers
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type
case object JsonNull extends JsonType

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait JsonType
class Object
trait Matchable
class Any
Show all
Self type
JsonNull.type
case class JsonNumber(d: Double) extends JsonType

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait JsonType
class Object
trait Matchable
class Any
Show all

Different ways of selecting elements in a Json object

Different ways of selecting elements in a Json object

Attributes

Supertypes
class Object
trait Matchable
class Any
case class JsonString(s: String) extends JsonType

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait JsonType
class Object
trait Matchable
class Any
Show all
sealed trait JsonType

abstract JSON types for specs2

abstract JSON types for specs2

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class JsonArray
class JsonBoolean
class JsonMap
object JsonNull
class JsonNumber
class JsonString
Show all
object JsonType

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JsonType.type
case class LeftCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[Either[T, Any], T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeCheckedMatcher[Either[T, Any], T]
trait Matcher[Either[T, Any]]
class Object
trait Matchable
class Any
Show all
case class LeftMatcher[T]() extends OptionLikeMatcher[Either[T, Any], T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeMatcher[Either[T, Any], T]
trait Matcher[Either[T, Any]]
class Object
trait Matchable
class Any
Show all

Attributes

Companion
object
Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type
trait MapMatchers

Matchers for Maps

Matchers for Maps

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object MapMatchers extends MapMatchers

Attributes

Companion
trait
Supertypes
trait MapMatchers
class Object
trait Matchable
class Any
Self type

this trait allows to fill-in stack traces on match results for precise location

this trait allows to fill-in stack traces on match results for precise location

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object MustMatchers
trait ResultChecks
trait DataTables
trait Tables
trait Tables
object Tables
trait Matchers
object Matchers
trait MustMatchers
trait Card
trait SpecLike
class Spec
trait SpecLike
class Spec
trait SpecLike
class Spec
trait Expectations
object Expectations
trait JsonMatchers
object JsonMatchers
object ReturnsSyntax
object TypedEqual
trait AsResultProp
object AsResultProp
trait ScalaCheck
Show all
trait Matcher[-T]

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 Result

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.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
Matcher[T]
object Matcher extends MatcherCreation

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Matcher.type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Matcher

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

This trait adds some implicits to easily fold sequences of results

This trait adds some implicits to easily fold sequences of results

Attributes

Companion
object
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type

Trait aggregating the most common specs2 matchers

Trait aggregating the most common specs2 matchers

Attributes

Companion
object
Supertypes
Known subtypes
object Matchers extends Matchers

Attributes

Companion
trait
Supertypes
Self type
Matchers.type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

This trait provides implicit definitions to check values with matchers by using a "must" syntax: value must matcher

This trait provides implicit definitions to check values with matchers by using a "must" syntax: value must matcher

Attributes

Companion
object
Supertypes
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type

This trait provides implicit definitions to transform any value into an Expectable which throws exceptions when a match fails

This trait provides implicit definitions to transform any value into an Expectable which throws exceptions when a match fails

Attributes

Companion
object
Supertypes
Known subtypes
case class NeverMatcher[T]() extends Matcher[T]

This matcher never matches any value of type T

This matcher never matches any value of type T

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[T]
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any

this trait doesn't fill-in stack traces

this trait doesn't fill-in stack traces

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any

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

Attributes

Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
trait NoTypedEqual extends TypedEqual

This trait can be used to suppress the TypedEqual implicit

This trait can be used to suppress the TypedEqual implicit

Attributes

Supertypes
trait TypedEqual
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any

Matchers for Numerical values

Matchers for Numerical values

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Matchers for Operation values

Matchers for Operation values

Attributes

Companion
object
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Self type
open class OptionLikeCheckedMatcher[T, U](typeName: String, toOption: T => Option[U], check: ValueCheck[U]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
Known subtypes
open class OptionLikeMatcher[T, U](typeName: String, toOption: T => Option[U]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
Known subtypes
class LeftMatcher[T]
class RightMatcher[T]
class SomeMatcher[T]
trait OptionMatchers extends ValueChecks

Matchers for Options

Matchers for Options

Attributes

Companion
object
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Self type
class OrderingMatcher[T] extends Matcher[Seq[T]]

Attributes

Supertypes
trait Matcher[Seq[T]]
class Object
trait Matchable
class Any
case class PathFunction(node: Node, function: XPathFunction, attributes: List[String] = ..., attributeValues: Map[String, String] = ..., exactMatch: Boolean = ..., textMessage: Option[String] = ..., textMatcher: Matcher[String] = ...) extends (Seq[Node]) => Seq[Node], XPathFunctions

The PathFunction object encapsulate a search for a node and/or attributes or attributeValues with an XPath function If node has some children, then they are searched using equality

The PathFunction object encapsulate a search for a node and/or attributes or attributeValues with an XPath function If node has some children, then they are searched using equality

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait (Seq[Node]) => Seq[Node]
class Object
trait Matchable
class Any
Show all
trait PathMatchers

The PathMatchers trait provides matchers which are applicable to strings representing paths

The PathMatchers trait provides matchers which are applicable to strings representing paths

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
object PathMatchers extends PathMatchers

Attributes

Companion
trait
Supertypes
trait PathMatchers
class Object
trait Matchable
class Any
Self type
case class PlusOrMinus[S](n: S, delta: S)

class representing a numeric range

class representing a numeric range

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait DataTables
trait Tables
trait Tables
object Tables
trait Matchers
object Matchers
trait MustMatchers
object MustMatchers
trait Card
trait SpecLike
class Spec
trait SpecLike
class Spec
trait SpecLike
class Spec
trait Expectations
object Expectations
trait JsonMatchers
object JsonMatchers
object ReturnsSyntax
object TypedEqual
trait AsResultProp
object AsResultProp
trait ScalaCheck
Show all

Matchers for Results

Matchers for Results

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Those definitions help specifying the result messages for matchers

Those definitions help specifying the result messages for matchers

Attributes

Companion
object
Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes
object ReturnsSyntax

Attributes

Companion
trait
Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type
case class RightCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[Either[Any, T], T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeCheckedMatcher[Either[Any, T], T]
trait Matcher[Either[Any, T]]
class Object
trait Matchable
class Any
Show all
case class RightMatcher[T]() extends OptionLikeMatcher[Either[Any, T], T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeMatcher[Either[Any, T], T]
trait Matcher[Either[Any, T]]
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Expectations
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all

This trait provides implicit definitions to check values with matchers by using a "should" syntax: value should matcher

This trait provides implicit definitions to check values with matchers by using a "should" syntax: value should matcher

Attributes

Companion
object
Supertypes
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait TypedEqual
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Self type

This trait provides implicit definitions to transform any value into an Expectable which throws exceptions when a match fails

This trait provides implicit definitions to transform any value into an Expectable which throws exceptions when a match fails

Attributes

Companion
object
Supertypes
Known subtypes
case class SignificantFigures(number: Int)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class SignificantTarget[T](target: T, significantFigures: SignificantFigures)(using evidence$1: Numeric[T])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class SizedCheckedMatcher[T](check: ValueCheck[Int], sizeWord: String)(using evidence$1: Sized[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
class SizedMatcher[T](n: Int, sizeWord: String)(using evidence$1: Sized[T]) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any
case class SomeCheckedMatcher[T](check: ValueCheck[T]) extends OptionLikeCheckedMatcher[Option[T], T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeCheckedMatcher[Option[T], T]
trait Matcher[Option[T]]
class Object
trait Matchable
class Any
Show all
case class SomeMatcher[T]() extends OptionLikeMatcher[Option[T], T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeMatcher[Option[T], T]
trait Matcher[Option[T]]
class Object
trait Matchable
class Any
Show all

The StringMatchers trait provides matchers which are applicable to String objects

The StringMatchers trait provides matchers which are applicable to String objects

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
class TerminationMatcher[-T](retries: Int = ..., sleep: Duration = ..., whenAction: Option[() => Any] = ..., whenDesc: Option[String] = ..., onlyWhen: Boolean = ...)(using ee: ExecutionEnv) extends Matcher[T]

Attributes

Supertypes
trait Matcher[T]
class Object
trait Matchable
class Any

This trait provides matchers to check if a block of code is terminating or not

This trait provides matchers to check if a block of code is terminating or not

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

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 checkResultFailure(r: =>Result) = { r match { case f @ Failure(ko, _, _, _) => throw new TestFailedException(f.message, f.exception, 0) case _ => () } m } }

Attributes

Companion
object
Supertypes
Known subtypes

Attributes

Companion
trait
Supertypes
Self type

Lightweight ThrownExpectations trait with less implicit methods

Lightweight ThrownExpectations trait with less implicit methods

Attributes

Supertypes
trait ResultChecks
class Object
trait Matchable
class Any
Show all
Known subtypes

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

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Matchers for traversables

Matchers for traversables

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Show all
Self type
case class TryFailureCheckedMatcher[T](check: ValueCheck[Throwable]) extends OptionLikeCheckedMatcher[Try[T], Throwable]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeCheckedMatcher[Try[T], Throwable]
trait Matcher[Try[T]]
class Object
trait Matchable
class Any
Show all
case class TryFailureMatcher[T]() extends OptionLikeMatcher[Try[T], Throwable]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class OptionLikeMatcher[Try[T], Throwable]
trait Matcher[Try[T]]
class Object
trait Matchable
class Any
Show all
trait TryMatchers

Matchers for util.Try instances

Matchers for util.Try instances

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class TrySuccessCheckedMatcher[T](check: ValueCheck[T]) extends Matcher[Try[T]]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[Try[T]]
class Object
trait Matchable
class Any
Show all
case class TrySuccessMatcher[T]() extends Matcher[Try[T]]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[Try[T]]
class Object
trait Matchable
class Any
Show all
object TryeMatchers extends TryMatchers

Attributes

Supertypes
trait TryMatchers
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any

Matchers for checking if a piece of code compiles or not

Matchers for checking if a piece of code compiles or not

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait TypedEqual

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

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type

Attributes

Companion
trait
Supertypes
trait ResultChecks
trait TypedEqual
class Object
trait Matchable
class Any
Show all
Self type
TypedEqual.type
trait ValueCheck[T]

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
object ValueCheck

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ValueCheck.type

implicit conversions used to create ValueChecks

implicit conversions used to create ValueChecks

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ValueChecks extends ValueChecks

Attributes

Companion
trait
Supertypes
trait ValueChecks
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class PathFunction
case class XmlMatcher(functions: Seq[PathFunction]) extends Matcher[Seq[Node]]

The XmlMatcher class matches an xml Node, or a list of Nodes against a list of search functions, which can either search for:

The XmlMatcher class matches an xml Node, or a list of Nodes against a list of search functions, which can either search for:

  • a given direct child, with its label and/or attributes and/or attributes names and values

  • a given child, direct or not (maybe deeply nested), with its label and/or attributes and/or attributes names and values

XmlMatchers can be "chained" by using the \ or the \ methods. In that case, the resulting matcher has a new search function which tries to match the result of the preceding function. For example

 
must \\("c").\("d")

will be ok.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Matcher[Seq[Node]]
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait XmlMatchers

The XmlMatchers trait provides matchers which are applicable to xml nodes

The XmlMatchers trait provides matchers which are applicable to xml nodes

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object XmlMatchers
object XmlMatchers extends XmlMatchers

Attributes

Companion
trait
Supertypes
trait XmlMatchers
class Object
trait Matchable
class Any
Self type

Types

type HasPath = { def getPath(): String; }

Value members

Inherited methods

protected def checkResultFailure(r: => Result): Result

this method can be overridden to throw exceptions when checking a result

this method can be overridden to throw exceptions when checking a result

Attributes

Inherited from:
ResultChecks
def createExpectable[T](t: => T, alias: String => String): Expectable[T]

Attributes

Returns

an Expectable with a description function

Inherited from:
ExpectationsCreation
def createExpectable[T](t: => T, alias: => String): Expectable[T]

Attributes

Returns

an Expectable with a description

Inherited from:
ExpectationsCreation
def createExpectable[T](t: => T): Expectable[T]

Attributes

Returns

an Expectable

Inherited from:
ExpectationsCreation
def createExpectable[T](t: => T, alias: Option[String => String]): Expectable[T]

Attributes

Returns

an Expectable with a description function

Inherited from:
ExpectationsCreation
def createExpectableWithShowAs[T](t: => T, showAs: => String): Expectable[T]

Attributes

Returns

an Expectable with a function to show the element T

Inherited from:
ExpectationsCreation
protected def mapResult(r: Result): Result

this method can be overridden to intercept a Result and modify it. It is used for example to set a stacktrace providing the location of a failure

this method can be overridden to intercept a Result and modify it. It is used for example to set a stacktrace providing the location of a failure

Attributes

Inherited from:
ResultChecks
protected def sandboxResult(r: => Result): Result

Attributes

Returns

the result without any side-effects

Inherited from:
ResultChecks
protected def setStacktrace(m: Result): Result

this method can be overridden to avoid filling-in a stacktrace indicating the location of the result

this method can be overridden to avoid filling-in a stacktrace indicating the location of the result

Attributes

Inherited from:
MatchResultStackTrace
def theBlock(t: => Nothing): Expectable[Nothing]

Attributes

Inherited from:
ExpectationsCreation
def theValue[T](t: => T): Expectable[T]

Attributes

Inherited from:
ExpectationsCreation

Extensions

Inherited extensions

extension [T](t: => T)(using evidence$1: AsResult[T])
infix def returns(m: String): Result

Attributes

Inherited from:
ReturnsSyntax
infix def returnsMatch(m: String): Result

Attributes

Inherited from:
ReturnsSyntax
infix def returnsResult(m: String): Result

Attributes

Inherited from:
ReturnsSyntax