=str #19377 improve expectNext() error reporting (if no element signaled)

This commit is contained in:
Konrad Malawski 2016-01-07 14:58:50 +01:00
parent 3f9b8f6dd3
commit 86504ec4e2

View file

@ -251,9 +251,13 @@ object TestSubscriber {
/**
* Expect and return a stream element.
*/
def expectNext(): I = probe.receiveOne(probe.remaining) match {
case OnNext(elem) elem.asInstanceOf[I]
case other throw new AssertionError("expected OnNext, found " + other)
def expectNext(): I = {
val t = probe.remaining
probe.receiveOne(t) match {
case null throw new AssertionError(s"Expected OnNext(_), yet no element signaled during $t")
case OnNext(elem) elem.asInstanceOf[I]
case other throw new AssertionError("expected OnNext, found " + other)
}
}
/**