Introduce static singleton object spying with real-method-call and strict-stub default behaviour #392
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new
withObjectSpied[...]works almost the same aswithObjectMocked[...]e.g. they are both strict by default, but with the following differences:Static singleton objects are already complete w.r.t to implementation, so the behaviour proposed here is for real methods to be called; this allows slight tweaks in its original behaviour, rather than having to reimplement in stubs.
Otherwise,
withObjectMocked[...]can still be used.Leniency settings are made available via an implicit parameters, with strict semantics enabled by default i.e. implicitly.
I did want to spend more time looking into some leniency-related enums I saw during this work, but thought get the PR out sooner rather than later, as it currently works.
@bbonanno do you think there is some de-duplication that can be done in this area?
Finally re: the version parsing, I wanted to try these changes on some code I am working on for my client;
publishLocalis annoying development-loop, when working across projects. I tried to use the following in my clientbuild.sbt:This however lead to errors locating the
version.propertiesfile; the changes seem to fix that. I can remove if it is considered undesirable, give also the creation ofproject/Helpers.scala