org.specs2.control

Type members

Classlikes

case
class Action[A](runNow: ExecutionEnv => Future[A], last: Vector[Finalizer])

Asynchronous action with:

Asynchronous action with:

  • an optional list of "finalization" actions to be executed when this action is done whether it has timed-out or thrown an exception. This allows resources to be safely disposed of
Companion
object
object Action
Companion
class
case
class ActionException(warnings: List[String], message: Option[String], throwable: Option[Throwable]) extends Exception

This exception class is used when an Action is transformed to a Task to avoid losing information

This exception class is used when an Action is transformed to a Task to avoid losing information

case
class ConsoleLogger() extends Logger

Logger implementation directing messages to the console

Logger implementation directing messages to the console

This trait provides simple a way to print out any object to the console:

This trait provides simple a way to print out any object to the console:

"this string".pp must ===("this string")

will print 'this string' and pass it to the rest of the expectation

Companion
object
object Debug extends Debug
Companion
class

default filter for specs2 runs

default filter for specs2 runs

trait DontConvertTo[T]

This trait provides methods to catch exceptions and transform them into values which can be passed to further computations.

This trait provides methods to catch exceptions and transform them into values which can be passed to further computations.

It uses the facilities found in the scala.util.control.Exception object while providing a more concise api on some use cases.

See also

org.specs2.control.ExceptionsSpec for examples

Companion
object
object Exceptions extends Exceptions
Companion
class
object Executable

Execute external commands

Execute external commands

This trait is used primarily to change the junit behavior depending on the execution environment

This trait is used primarily to change the junit behavior depending on the execution environment

Companion
object
Companion
class
case
class Finalizer(run: () => Unit)

Delayed action

Delayed action

Companion
object
object Finalizer
Companion
class
trait Functions

This trait provides utility methods for functions

This trait provides utility methods for functions

Companion
object
object Functions extends Functions
Companion
class

This trait describes something which has a stackTrace with:

This trait describes something which has a stackTrace with:

  • a list of stacktrace element

This is used to provide a common interface to execute.Failure and execute.Error

This trait is used to abuse method overloading and allow some of the methods in specs2 DSL to be applicable to various parameters.

This trait is used to abuse method overloading and allow some of the methods in specs2 DSL to be applicable to various parameters.

For example in a mutable specification, the >> method is overloaded for lots of different arguments:

  • result
  • function of the Environment
  • function of the Command line
  • ...
Companion
object
case
class IncludeExcludeStackTraceFilter(include: Seq[String], exclude: Seq[String]) extends StackTraceFilter

Implementation of the StackTraceFilter trait with a list of include/exclude patterns

Implementation of the StackTraceFilter trait with a list of include/exclude patterns

Companion
object

Factory object to build a stack trace filter from include/exclude expressions:

Factory object to build a stack trace filter from include/exclude expressions:

.*specs2 ==> include .*specs2 traces .specs2/scala. ==> include .specs2 traces, exclude scala. traces .*specs2,eclipse ==> include .*specs2,scala traces and eclipse traces

Companion
class
class Lazy[+T](v: () => T)(using x$2: CanEqual[T, T])

class holding a value to be evaluated lazily

class holding a value to be evaluated lazily

These functions can be used to allow some function to be called with varargs, with values being evaluated lazily:

These functions can be used to allow some function to be called with varargs, with values being evaluated lazily:

 def method[T](values: Lazy[T]*) = {
   values.to(LazyList) // use the toStream method to consume the values lazily
 }
 // usage
 method(exp1, exp2, exp3)

Note that the values are really evaluated once, unlike a by-name parameter.

Companion
object
Companion
class
case
class LazyValue[T](t: () => T)

This class simply encapsulates a lazy value which will be only evaluated once

This class simply encapsulates a lazy value which will be only evaluated once

See also

org.specs2.specification.process.RandomSequentialExecutor for an example of use

trait Logger

specs2 logger support

specs2 logger support

case
class NamedThreadFactory(namePrefix: String, group: ThreadGroup, priority: Int) extends ThreadFactory

This factory creates named threads which can be prefixed by "specs2" to track the threads used by specs2 for the specification execution

This factory creates named threads which can be prefixed by "specs2" to track the threads used by specs2 for the specification execution

Contributed by @jedws

trait NoDebug extends Debug

Use this trait to disable the pp method on objects

Use this trait to disable the pp method on objects

object NoLogger extends Logger

This filter doesn't do anything

This filter doesn't do anything

Syntactic sugar to execute an action a given number of times

Syntactic sugar to execute an action a given number of times

Companion
object
Companion
class
case
class Operation[A](operation: () => Either[Throwable, A], last: Vector[Finalizer])

Synchronous action with:

Synchronous action with:

  • an optional list of "finalization" actions to be executed when this action is done if it throws an exception. This allows resources to be safely disposed of

It is essentially the same as an Action without the asynchronicity

Companion
object
object Operation
Companion
class
Companion
object
object Properties extends Properties
Companion
class
case
class Property[T](value: () => Option[T], evaluated: Boolean, evaluatedValue: Option[T])(using x$4: CanEqual[T, T])

This class represents values which are evaluated lazily and which may even be missing.

This class represents values which are evaluated lazily and which may even be missing.

It has Option-like function and can be also converted to an Either object

Companion
object
object Property

Companion object to create properties with possibly no initial value

Companion object to create properties with possibly no initial value

Companion
class
class Ref[T](var toOption: Option[T])

class holding an optional mutable value

class holding an optional mutable value

Companion
object
object Ref
Companion
class
trait Safe[F[_]]

Typeclass for "safe" actions which are actions which can be attempted or finalized

Typeclass for "safe" actions which are actions which can be attempted or finalized

Companion
object
object Safe
Companion
class

This trait filters an Exception stacktrace

This trait filters an Exception stacktrace

Companion
object
Companion
class

Utility methods to determine the origin of the execution of the current code

Utility methods to determine the origin of the execution of the current code

Companion
object
object Stacktraces extends Stacktraces
Companion
class
case
class StringOutputLogger(output: StringOutput) extends Logger
object Throwables

This trait adds some utility methods to Throwable objects.

This trait adds some utility methods to Throwable objects.

Companion
object
object Throwablex extends Throwablex
Companion
class
case
class Times(n: Int)
case
class TraceLocation(path: String, fileName: String, className: String, methodName: String, lineNumber: Int)
Companion
object
Companion
class
object Use

Utility object to show a parameter as used In particular this is useful to avoid warnings with ImplicitParameters

Utility object to show a parameter as used In particular this is useful to avoid warnings with ImplicitParameters

case
class UserException(message: String, throwable: Throwable) extends Exception

This exception class is used to notify the user of instantiation errors

This exception class is used to notify the user of instantiation errors