object
Assertion
Type Members
-
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
-
-
final
def
asInstanceOf[T0]: T0
-
def
between[A](min: A, max: A)(implicit ordering: Ordering[A]): Assertion[A]
-
def
clone(): AnyRef
-
def
contains(string: String): Assertion[String]
-
def
divisibleBy[A](n: A)(implicit numeric: Numeric[A]): Assertion[A]
-
def
endsWith(suffix: String): Assertion[String]
-
-
def
equalTo[A](value: A): Assertion[A]
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
greaterThan[A](value: A)(implicit ordering: Ordering[A]): Assertion[A]
-
def
greaterThanOrEqualTo[A](value: A)(implicit ordering: Ordering[A]): Assertion[A]
-
def
hasLength(lengthAssertion: Assertion[Int]): Assertion[String]
-
def
hashCode(): Int
-
val
isEmptyString: Assertion[String]
-
final
def
isInstanceOf[T0]: Boolean
-
def
lessThan[A](value: A)(implicit ordering: Ordering[A]): Assertion[A]
-
def
lessThanOrEqualTo[A](value: A)(implicit ordering: Ordering[A]): Assertion[A]
-
-
def
matches(regexString: String): Assertion[String]
-
def
matches(regex: Regex): Assertion[String]
-
-
-
def
notEqualTo[A](value: A): Assertion[A]
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
powerOf[A](base: A)(implicit numeric: Numeric[A]): Assertion[A]
-
def
startsWith(prefix: String): Assertion[String]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
An
Assertion[A]
is essentially a composable predicate fromA => Boolean
. They can be composed with standard Boolean operators of&&
,||
and!
. This is primarily intended to be used withNewtype
andSubtype
, enhancing them with compile-time time validation.For example, if you'd like to validate that a particular Int is precisely 4 digits long, you can create the following refined Newtype. (Note that the syntax is slightly difference between Scala 2 and Scala 3).