Mockito Sugar for Scala
This library does not depend on any specific testing framework! Therefore you are free to use it with
ScalaTest or something else.
The Java API for Mockito is good, but once you are used to some syntactic conveniences from
Mockito trait, it feels very clunky. When using other test frameworks that
specs2, there was up until now nothing that provides this form of convenience, therefore this library was written.
This library provides a lightweight Scala DSL around Mockito's Java API. The goals are:
- more convenient syntax
- less runtime exceptions on API misuse
- easy to fall back to Java API when necessary
Add it to your
libraryDependencies ++= Seq( "org.markushauck" %% "mockitoscala" % "0.3.0" )
or import it in
Finally, extend from MockitoSugar trait in your test suite or import all members of the companion object.
Please see Examples for an overview of what is currently possible.
Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.
This code is open source software licensed under the Apache 2.0 License.