Does Smockito support Scala 2?
No. Smockito leverages a handful of powerful Scala 3 features, such as inlining, opaque types, context functions, match types and named tuples. If you are in the process of migrating a Scala 2 codebase, it might be a good opportunity to replace the likes of specs2-mock or mockito-scala as you migrate your modules.
Does Smockito support old Scala 3 LTS versions?
No. Smockito will upgrade to the latest LTS version of Scala 3 once released, making sure the library is compatible with the latest language features and improvements. You may resort to old Smockito versions, but no further bug fixes or new features will be provided for them.
How thread-safe is Smockito?
The same as Mockito, which supports tracking concurrent calls to an already-configured shared mock, but not concurrent stubbing or verification.
Is this really a mocking framework?
This is a facade for Mockito, which in itself is technically a test spy framework. There is a great debate regarding the definitions of mocks, stubs, spies, test duplicates... Here, we assume a mock to be a "faked" object, and a stub a provided implementation for a subset of the input space.
I am getting a "Sharing is only supported for boot loader classes..." warning.
That is okay and is related to the way Mockito performs runtime bytecode manipulation. See this issue for further discussion.
Can I resort to underlying Mockito APIs directly?
Yes; Mockito is in the classpath when one depends on Smockito. You may choose to do so to use some functionality Smockito does not provide, such as deep stubs. However, Smockito is designed to cover the most common and logical use cases – the on, times and calls trio available via the Smockito trait should be enough for most of your needs. Avoid importing org.mockito directly in your tests if not necessary, as the raw APIs may not account for Scala quirks such as by-name parameters and vararg expansions that Smockito handles for you.
I can't seem to stub a method/I found a bug.
Are you performing eta-expansion correctly? Check out the main SmockitoSpec for more examples covering a variety of situations. If everything looks fine on your side, please file an issue with a minimal reproducible example.
What can I do with the source code?
Mostly anything you want to. Check the license. All contributions are appreciated!