OrSpec

open class OrSpec<T> : CompositeSpec<T> (source)

A CompositeSpec which requires any one of its specs to be true in order to evaluate to true. As an exception, an OrSpec with no specs is satisfied by every object.

Uses lazy evaluation: member specs are evaluated in order, stopping at the first satisfied one.

Since

0.7

Parameters

<T>

The target type for this Spec

Constructors

Link copied to clipboard
constructor()
Creates a spec with no member specs, which is satisfied by every object.
constructor(specs: Array<Spec<in T>>)
Creates a spec with the given member specs, in order.
constructor(specs: Iterable<out Spec<in T>>)
Creates a spec with the member specs of the given iterable, in iteration order.

Properties

Link copied to clipboard
val EMPTY: OrSpec<out Any>
The shared OrSpec with no member specs, satisfied by every object.

Functions

Link copied to clipboard
open fun <T> empty(): OrSpec<T>
Returns the shared OrSpec with no member specs, which is satisfied by every object.
Link copied to clipboard
fun equals(o: Any): Boolean
Link copied to clipboard
open fun getSpecs(): List<Spec<in T>>
Returns an unmodifiable view of the member specs, in order.
Link copied to clipboard
fun hashCode(): Int
Link copied to clipboard
operator fun <T> Spec<T>.invoke(arg: T): Boolean

Enables function invocation syntax on Spec instances.

Link copied to clipboard
open fun isEmpty(): Boolean
Returns whether this spec has no member specs.
Link copied to clipboard
open fun isSatisfiedBy(object: T): Boolean
Returns whether the given element satisfies this spec.
Link copied to clipboard
open fun or(specs: Array<Spec<in T>>): OrSpec<T>
Returns an OrSpec whose member specs are this spec's, followed by the given ones.
Link copied to clipboard
open fun toString(): String