object AssertUtil
This module contains additional higher-level assert statements that are ultimately based on junit.Assert primitives.
Avoid adding methods, and above all *fields* (including lazy vals), that
require JVM-specific features such as run-time reflection. Otherwise, all
tests using this object stop working in Scala.js. Put such methods in
ReflectUtil instead. (ClassTags are fine; they are supported in
Scala.js and Scala Native.)
- Source
- AssertUtil.scala
- Alphabetic
- By Inheritance
- AssertUtil
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class Probe(depth: Int) extends ControlThrowable with Product with Serializable
To be thrown by test code to check stack depth.
- sealed trait Progress extends AnyRef
How frequently to check a termination condition.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def assertCond[A](x: A)(pf: PartialFunction[A, Boolean]): Unit
- def assertCondNot[A](x: A)(pf: PartialFunction[A, Boolean]): Unit
- def assertEqualStrings(expected: String)(actual: String): Unit
- def assertEqualsAny(message: => String, expected: Any, actual: Any): Unit
- def assertEqualsAny(expected: Any, actual: Any): Unit
- def assertFails[U](checkMessage: (String) => Boolean)(body: => U): Unit
- def assertNotEqualsAny(message: => String, expected: Any, actual: Any): Unit
- def assertNotEqualsAny(expected: Any, actual: Any): Unit
- def assertNotReachable[A <: AnyRef](a: => A, roots: AnyRef*)(body: => Unit): Unit
Value is not strongly reachable from roots after body is evaluated.
- def assertSameElements[A, B >: A](expected: Array[A], actual: Array[B], message: String): Unit
- def assertSameElements[A, B >: A](expected: Array[A], actual: Array[B]): Unit
Convenience for testing arrays.
Convenience for testing arrays. Avoids warning about implicit conversion to Seq.
- def assertSameElements[A, B >: A](expected: IterableOnce[A], actual: IterableOnce[B]): Unit
Convenience for testing iterators and non-Seqs.
Convenience for testing iterators and non-Seqs. The
expectedis collected to aListfor reporting errors. - def assertSameElements[A, B >: A](expected: Seq[A], actual: IterableOnce[B]): Unit
Convenience for testing iterators and non-Seqs.
Convenience for testing iterators and non-Seqs. The
actualis collected to aListfor reporting errors. - def assertSameElements[A, B >: A](expected: Seq[A], actual: Iterable[B], message: String = ""): Unit
JUnit-style assertion for
Seq#sameElements.JUnit-style assertion for
Seq#sameElements. Theactualis iterated twice if failure is reported. - def assertStackSafe[A](run1: => A, run2: => A): Unit
- def assertThrown[T <: Throwable](checker: (T) => Boolean)(body: => Any)(implicit arg0: ClassTag[T]): Unit
Assert that the exception was thrown while evaluating
body, and that the exception instance satisfies thecheckerpredicate. - def assertThrows[T <: Throwable](body: => Any, checkMessage: (String) => Boolean = _ => true)(implicit arg0: ClassTag[T]): Unit
Check that throwable T (or a subclass) was thrown during evaluation of
body, and that its message satisfies thecheckMessagepredicate.Check that throwable T (or a subclass) was thrown during evaluation of
body, and that its message satisfies thecheckMessagepredicate. Any other exception is propagated. - def assertZeroNetThreads[A](group: ThreadGroup)(body: => A): Try[A]
- def assertZeroNetThreads(body: => Unit): Unit
Assert no new threads, with some margin for arbitrary threads to exit.
- def bail(): Nothing
- def bailable(name: String)(test: => Unit): Unit
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def elapsed[U](body: => U): Duration
Elapsed duration.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fail(message: String): Nothing
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hexdump(s: String): Iterator[String]
- def intercept[T <: Throwable](body: => Any)(implicit arg0: ClassTag[T]): Unit
Expect the exception is thrown by evaluating
body. - def interceptMessage[T <: Throwable](expected: String)(body: => Any)(implicit arg0: ClassTag[T]): Unit
Expect the exception thrown with exactly the given message.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noWin(message: String = "skipping test on Windows")(body: => Unit): Unit
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def probeStackSafety[A](): A
To be called by test code to check stack depth from assertStackSafe.
- def readyOrNot(awaitable: Awaitable[_]): Boolean
Like Await.ready but return false on timeout, true on completion, throw InterruptedException.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def timed[A](body: => A): (A, Duration)
Result and elapsed duration.
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def waitFor[A](value: => Option[A], progress: Progress = Fast, label: => String = "test"): A
Wait for a value or eventually throw.
- def waitForIt(terminated: => Boolean, progress: Progress = Fast, label: => String = "test"): Unit
Wait for a condition, with a simple back-off strategy.
Wait for a condition, with a simple back-off strategy.
This makes it easier to see hanging threads in development without tweaking a timeout parameter. Conversely, when a thread fails to make progress in a test environment, we allow the wait period to grow larger than usual, since a long wait for failure is acceptable.
It would be nicer if what we're waiting for gave us a progress indicator: we don't care if something takes a long time, so long as we can verify progress.
- def withElapsed[A](f: (Duration) => Unit)(body: => A): A
Elapsed duration.
- def withoutATrace[A](body: => A): NoTrace[A]
- case object Fast extends Progress with Product with Serializable
- case object Slow extends Progress with Product with Serializable