You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wan't to allow mocking only traits and abstract classes without parameters.
Why I want to do this:
This change will encourage users to create interfaces for their classes and classes they have no access to, which is a good practice simplifying testing (also this complies to SOLID)
This will simplify maintenance of library, no need to handle each case internally (e.g. tagged parameters with supertagged or whatever else)
For closed classes without access users will create an interface, like this.
This is an interesting idea for sure and would eliminate some of the more complex workarounds. But one of the main points of mocking is often (in my experience) to hide collaborators that you have no control over - so, library APIs or stateful objects of some kind.
Of course writing a facade might be possible in some cases to create a deliberate boundary that you can then mock, but I wonder how many people would be willing to do that. As a developer, i would be weighing up the effort of doing that vs using a different framework that allows me to mock such complexity.
So as I see it, there is a risk that it makes ScalaMock easier to maintain and cleaner as a tool, but also less desirable to use at the same time.
This is an interesting idea for sure and would eliminate some of the more complex workarounds. But one of the main points of mocking is often (in my experience) to hide collaborators that you have no control over - so, library APIs or stateful objects of some kind. Of course writing a facade might be possible in some cases to create a deliberate boundary that you can then mock, but I wonder how many people would be willing to do that. As a developer, i would be weighing up the effort of doing that vs using a different framework that allows me to mock such complexity. So as I see it, there is a risk that it makes ScalaMock easier to maintain and cleaner as a tool, but also less desirable to use at the same time.
I wan't to allow mocking only traits and abstract classes without parameters.
Why I want to do this:
For closed classes without access users will create an interface, like this.
This will generate a warning in 7.0.0 allowing users to migrate and will be removed in 8.0.0.The text was updated successfully, but these errors were encountered: