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
Linear Supertypes
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AssertUtil
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. case class Probe(depth: Int) extends ControlThrowable with Product with Serializable

    To be thrown by test code to check stack depth.

  2. sealed trait Progress extends AnyRef

    How frequently to check a termination condition.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def assertCond[A](x: A)(pf: PartialFunction[A, Boolean]): Unit
  6. def assertCondNot[A](x: A)(pf: PartialFunction[A, Boolean]): Unit
  7. def assertEqualStrings(expected: String)(actual: String): Unit
  8. def assertEqualsAny(message: => String, expected: Any, actual: Any): Unit
  9. def assertEqualsAny(expected: Any, actual: Any): Unit
  10. def assertFails[U](checkMessage: (String) => Boolean)(body: => U): Unit
  11. def assertNotEqualsAny(message: => String, expected: Any, actual: Any): Unit
  12. def assertNotEqualsAny(expected: Any, actual: Any): Unit
  13. def assertNotReachable[A <: AnyRef](a: => A, roots: AnyRef*)(body: => Unit): Unit

    Value is not strongly reachable from roots after body is evaluated.

  14. def assertSameElements[A, B >: A](expected: Array[A], actual: Array[B], message: String): Unit
  15. 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.

  16. 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 expected is collected to a List for reporting errors.

  17. 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 actual is collected to a List for reporting errors.

  18. 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. The actual is iterated twice if failure is reported.

  19. def assertStackSafe[A](run1: => A, run2: => A): Unit
  20. 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 the checker predicate.

  21. 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 the checkMessage predicate.

    Check that throwable T (or a subclass) was thrown during evaluation of body, and that its message satisfies the checkMessage predicate. Any other exception is propagated.

  22. def assertZeroNetThreads[A](group: ThreadGroup)(body: => A): Try[A]
  23. def assertZeroNetThreads(body: => Unit): Unit

    Assert no new threads, with some margin for arbitrary threads to exit.

  24. def bail(): Nothing
  25. def bailable(name: String)(test: => Unit): Unit
  26. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  27. def elapsed[U](body: => U): Duration

    Elapsed duration.

  28. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  30. def fail(message: String): Nothing
  31. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  32. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  33. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  34. def hexdump(s: String): Iterator[String]
  35. def intercept[T <: Throwable](body: => Any)(implicit arg0: ClassTag[T]): Unit

    Expect the exception is thrown by evaluating body.

  36. def interceptMessage[T <: Throwable](expected: String)(body: => Any)(implicit arg0: ClassTag[T]): Unit

    Expect the exception thrown with exactly the given message.

  37. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. def noWin(message: String = "skipping test on Windows")(body: => Unit): Unit
  40. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  42. def probeStackSafety[A](): A

    To be called by test code to check stack depth from assertStackSafe.

  43. def readyOrNot(awaitable: Awaitable[_]): Boolean

    Like Await.ready but return false on timeout, true on completion, throw InterruptedException.

  44. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  45. def timed[A](body: => A): (A, Duration)

    Result and elapsed duration.

  46. def toString(): String
    Definition Classes
    AnyRef → Any
  47. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  48. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  49. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  50. def waitFor[A](value: => Option[A], progress: Progress = Fast, label: => String = "test"): A

    Wait for a value or eventually throw.

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

  52. def withElapsed[A](f: (Duration) => Unit)(body: => A): A

    Elapsed duration.

  53. def withoutATrace[A](body: => A): NoTrace[A]
  54. case object Fast extends Progress with Product with Serializable
  55. case object Slow extends Progress with Product with Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped