github scalamock/scalamock v7.3.1
7.3.1

latest releases: v7.4.2, v7.4.1, v7.4.0...
4 months ago

What's Changed

Added not implemented method description to NotImplementedError. Now you will also see failed method

Added new simple methods to StubbedMethod, StubbedIOMethod, StubbedZIOMethod.
Examples are below

StubbedMethod - returnsWith

Allows to set result for all arguments

trait Foo:
  def foo(x: Int): String

val foo = stub[Foo]

foo.foo.returnsWith("1")

StubbedIOMethod - succeedsWith and raisesErrorWith

trait Foo:
  def foo(x: Int): IO[String]

val foo = stub[Foo]

for {
  _ <- foo.foo.succeedsWith("1")
  _ <- foo.foo.raisesErrorWith(new RuntimeException("fail"))
} yield ()

StubbedZIOMethod - succeedsWith, failsWith, diesWith

trait Foo:
  def foo(x: Int): IO[Int, String]

val foo = stub[Foo]

for {
  _ <- foo.foo.succeedsWith("1")
  _ <- foo.foo.failsWith(2)
  _ <- foo.foo.diesWith(new RuntimeException("die"))
} yield ()

Updates

Don't miss a new scalamock release

NewReleases is sending notifications on new releases.