
com.wavesplatform.test.ProduceError.scala Maven / Gradle / Ivy
The newest version!
package com.wavesplatform.test
import org.scalatest.matchers.{MatchResult, Matcher}
import scala.util.{Left, Right}
class ProduceError(errorMessage: String) extends Matcher[Either[_, _]] {
override def apply(ei: Either[_, _]): MatchResult = {
ei match {
case r @ Right(_) => MatchResult(matches = false, "expecting Left(...{0}...) but got {1}", "got expected error", IndexedSeq(errorMessage, r))
case l @ Left(_) =>
MatchResult(matches = l.toString contains errorMessage,
"expecting Left(...{0}...) but got {1}",
"got expected error",
IndexedSeq(errorMessage, l))
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy