scala3mock

scala3mock

  • Docs
  • GitHub

scala3mockNative Scala 3 mocking system

Get Started

Simple syntax

withExpectations() {
    // 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))
}

Simple yet powerful: Scala3Mock has very clean and concise syntax, reasonable defaults, powerful features and is fully type-safe.

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

Popular Test framework integration: Scala3Mock can be easily used in ScalaTest and Munit testing frameworks.

Quick Start: Quick introduction to Scala3Mock describing basic usage of this mocking framework

User Guide: Complete Scala3Mock manual with lots of hints and examples

Open Source: Scala3Mock is open source and licenced under the MIT licence

Scala3Mock is a soft fork of ScalaMock and would not exists without it.
We are very grateful to all the work that was put into ScalaMock over the years.

scala3mock
Docs
Getting StartedFAQ
Copyright (c) 2022-2023 François Monniot