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

com.github.pawelkrol.CommTest.Expectation.scala Maven / Gradle / Ivy

There is a newer version: 0.05
Show newest version
package com.github.pawelkrol.CommTest

class Expectation[T](code: () => T) {

  private def validateNoChange[T](code: () => T, predicate: () => T) {
    val initial = predicate()
    code()
    val ending = predicate()
    assert(initial == ending, "expected that '%s' does not change, but it changed to '%s'".format(initial, ending))
  }

  def toChange[T](predicate: => T) = ChangeValidator(code, () => predicate)

  def notToChange[T](predicate: => T) = validateNoChange(code, () => predicate)
}

object Expectation {

  def apply[T](code: () => T) = new Expectation(code)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy