Play Test Mock

  • test mock
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    import org.specs2.mock._
    import org.specs2.matcher.JsonMatchers
    import org.mockito.{Matchers => M}
    class OneSpec extends Specification with JsonMatchers with Mockito {
    "#one" should {
    "normal one" in {
    implicit val Onemock:One = mock[One]
    Onemock.commit(M.anyString(), M.any[Int]) returns true
    val res = new One().commit("string", 2)
    res must beTrue
    }
    }
    }