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

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

package org.specs2
package matcher

/**
 * This kind of expectable can be followed by the verb must to apply a matcher:
 * 
 * `1 must beEqualTo(1)`
 * 
 * For convenience, several mustMatcher methods have also been defined as shortcuts to equivalent:
 * 
 * `a must matcher`
 */
class MustExpectable[T] private[specs2] (tm: () => T) extends Expectable[T](tm) { outer =>
  def must(m: =>Matcher[T])      = applyMatcher(m)
  def mustEqual(other: =>Any)    = applyMatcher(new BeEqualTo(other))
  def mustNotEqual(other: =>Any) = applyMatcher(new BeEqualTo(other).not)
  def must_==(other: =>Any)      = applyMatcher(new BeEqualTo(other))
  def must_!=(other: =>Any)      = applyMatcher(new BeEqualTo(other).not)
}
object MustExpectable {
  def apply[T](t: =>T) = new MustExpectable(() => t)
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy