!htp convert List[Rejection] => immutable.Seq[Rejection] everywhere

This commit is contained in:
Johannes Rudolph 2014-10-13 17:38:50 +02:00
parent 82a0fb381e
commit 0e06406e19
9 changed files with 47 additions and 40 deletions

View file

@ -83,7 +83,7 @@ trait RouteTest extends RequestBuilding with RouteTestResultComponent {
case _ Nil
}
def rejections: List[Rejection] = result.rejections
def rejections: immutable.Seq[Rejection] = result.rejections
def rejection: Rejection = {
val r = rejections
if (r.size == 1) r.head else failTest("Expected a single rejection but got %s (%s)".format(r.size, r))

View file

@ -21,12 +21,12 @@ trait RouteTestResultComponent {
* A receptacle for the response or rejections created by a route.
*/
class RouteTestResult(timeout: FiniteDuration)(implicit fm: FlowMaterializer) {
private[this] var result: Option[Either[List[Rejection], HttpResponse]] = None
private[this] var result: Option[Either[immutable.Seq[Rejection], HttpResponse]] = None
private[this] val latch = new CountDownLatch(1)
def handled: Boolean = synchronized { result.isDefined && result.get.isRight }
def rejections: List[Rejection] = synchronized {
def rejections: immutable.Seq[Rejection] = synchronized {
result match {
case Some(Left(rejections)) rejections
case Some(Right(response)) failTest("Request was not rejected, response was " + response)