ScalaMock was perhaps the first mocking framework which understood that Scala is a different language than Java. It played on the fact that Scala allows both functional and object-oriented code. Therefore, the mocking framework for Scala needs to be able to mock both these as aspects of a Scala class.
It is a native framework and it allows mocking of both functions and objects. Paul Butcher wrote Scala mock.
Type safe
Open source
Support for Scala-specific features such as:
Operator methods
Method overloading
Pattern matching
Parameterized methods
Compatible with both ScalaTest and Specs2
We need to mix MockFactory
into our test suite for us to be able to use ScalaMock
with ScalaTest
, as per the following example:
import org.scalatest.FlatSpec import org.scalamock.scalatest.MockFactory class BaseSuite extends FlatSpec with MockFactory with ...