Releases: scalamock/scalamock
7.3.2
What's Changed
StubbedMethod0[R]
will be replaced with StubbedMethod[Unit, R]
to make model simpler and allow to generalize with different methods. To make it possible - we need to make its API similar.
Thats why:
returns
inStubbedMethod0
is deprecated,returnsWith
should be used insteadreturnsZIO
inStubbedZIOMethod0
is deprecated,returnsZIOWith
or other methods should be used insteadreturnsIO
inStubbedIOMethod0
is deprecated,returnsIOWith
or other methods should be used instead
After 01.07.2025 new minor version will be published without StubbedMethod0
and deprecated methods will change their signatures to ones from StubbedMethod
.
Full Changelog: v7.3.1...v7.3.2
7.3.1
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 {
_ &l
10000
t;- foo.foo.succeedsWith("1")
_ <- foo.foo.failsWith(2)
_ <- foo.foo.diesWith(new RuntimeException("die"))
} yield ()
Updates
- Update cats-effect to 3.6.1 by @scala-steward in #626
- Update munit-cats-effect to 2.1.0 by @scala-steward in #624
- Update zio, zio-test, zio-test-sbt to 2.1.17 by @scala-steward in #625
- Update sbt-ci-release to 1.9.3 by @scala-steward in #620
- Update sbt, scripted-plugin to 1.10.11 by @scala-steward in #621
7.3.0
What's Changed
Bring new stubs with support for ZIO/cats IO to scala 3 LTS, 2.13 and 2.12.
Full Changelog: v7.2.0...v7.3.0
7.3.0-RC4
Fixes bug introduced in 7.3.0-RC3 when timesIO
runs forever
Changes to scalamock 7 Stubs
- Bring
Stub[T]
to scala 2 to make it same as for scala 3. Implicit conversions will compile only forStub[T]
- Fix issue for scala 3 when compilation not fails even if it should due to better language type inference.
- Improve scaladoc
- Remove auto eta-expansion for any nullary method selection in scala 3 to show correct errors. You should declare method selection as
() => R
which scala itself enforces
trait Foo:
def nullary: String
val foo = stub[Foo]
foo.nullary.returns("") // No longer compiles
(() => foo.nullary).returns("") // Compiles
The only exception is IO
and ZIO
types, still works for them. Now also works for scala 2.
trait Foo {
def nullary: IO[Int]
}
val foo = stub[Foo]
foo.nullary.returns(IO(1)) // Compiles
7.3.0-RC3
Changes to scalamock 7 Stubs
- Bring
Stub[T]
to scala 2 to make it same as for scala 3. Implicit conversions will compile only forStub[T]
- Fix issue for scala 3 when compilation not fails even if it should due to better language type inference.
- Improve scaladoc
- Remove auto eta-expansion for any nullary method selection in scala 3 to show correct errors. You should declare method selection as
() => R
which scala itself enforces
trait Foo:
def nullary: String
val foo = stub[Foo]
foo.nullary.returns("") // No longer compiles
(() => foo.nullary).returns("") // Compiles
The only exception is IO
and ZIO
types, still works for them. Now also works for scala 2.
trait Foo {
def nullary: IO[Int]
}
val foo = stub[Foo]
foo.nullary.returns(IO(1)) // Compiles
7.3.0-RC2
What's Changed
- fix nullary unit method generation by @goshacodes in #601
- fix scala 3 implicit conversions for methods without arguments by @goshacodes in #609
- Update scala-library, scala-reflect to 2.13.16 by @scala-steward in #604
- update zio, scala-js, specs2 by @goshacodes in #610
Full Changelog: v7.3.0-RC1...v7.3.0-RC2
v7.3.0-RC1
What's Changed
- Backport stubs to scala 2.12 and 2.13 (No other notable changes, so upgrade from scalamock 6 should be without any problems)
- Downgrade scala 3 compiler to 3.3.0, this allows to remove
@experimental
annotation - Downgrade java to 11
- Huge refactoring to make it compatible with scala 2. Should be no breaking changes
v7.2.0
What's Changed
- fix constructor parameter types related problems by @goshacodes in #585
- fix methods returning this.type by @goshacodes in #588
Full Changelog: v7.1.0...v7.2.0
v6.2.0
What's Changed
- fix scala 3 constructor parameter types related problems by @goshacodes in #586
- fix scala 3 methods returning this.type by @goshacodes in #587
Full Changelog: v6.1.1...v6.2.0
7.1.0
What's Changed
- basic call log support by @goshacodes in #569
- wrap NotImplementedError with effect if needed by @goshacodes in #568
Full Changelog: v7.0.1...v7.1.0