All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.specs2.matcher.StoredExpectations.scala Maven / Gradle / Ivy

package org.specs2
package matcher

import execute.Result

/**
 * This trait evaluates expectations and stores them in a local variable for further usage
 */
trait StoredExpectations extends Expectations {
  private[specs2] lazy val results = new scala.collection.mutable.ListBuffer[Result]

  override protected def checkResultFailure(r: Result): Result = {
    results.append(r)
    r
  }
  override protected def checkMatchResultFailure[T](m: MatchResult[T]): MatchResult[T] = {
    checkResultFailure(m.toResult)
    m
  }

  def storedResults: Seq[Result] = {
    val rs = results.toSeq
    results.clear()
    rs
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy