Write better tests with

ScalaMock

Simple yet powerful native Scala mocking framework.

def testTurtle {
  // Create mock Turtle object
  val mockedTurtle = mock[Turtle]
 
  // Set expectations
  (mockedTurtle.setPosition _).expects(10.0, 10.0)
  (mockedTurtle.forward _).expects(5.0)
  (mockedTurtle.getPosition _).expects().returning(15.0, 10.0)
 
  // Exercise System Under Test
  drawLine(mockedTurtle, (10.0, 10.0), (15.0, 10.0))
}

Features

Simple yet powerful

ScalaMock has very clean and concise syntax, reasonable defaults, powerful features and is fully type-safe.

Full Scala support

Full support for Scala features such as: Polymorphic methods, Operators, Overloaded methods, Type constraints, and more.

ScalaTest and Specs2 integration

ScalaMock can be easily used in ScalaTest and Specs2 testing frameworks.

Documentation

Also find us on Scaladex