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
It is common in the Java world to not want to introduce an interface only for the sake of testing, due to Java classes and members being non-final by default. Mockative can enable mocking of open and abstract classes and members by generating mocks for these the same as they're currently generated for interface types. The catch is we'll need to recursively generate mocks for the dependencies of these classes as well, in order to construct instances of the mocks.
Notes
Generating mocks for open classes and members can also enable implicitly stubbing members like in Mockito, as long as the return types themselves are also open and can have mocks generated for them. While this may be more feasible with class mocks, it is not a goal of this proposal.
The text was updated successfully, but these errors were encountered:
Description
It is common in the Java world to not want to introduce an
interface
only for the sake of testing, due to Java classes and members being non-final
by default. Mockative can enable mocking ofopen
andabstract
classes and members by generating mocks for these the same as they're currently generated forinterface
types. The catch is we'll need to recursively generate mocks for the dependencies of these classes as well, in order to construct instances of the mocks.Notes
Generating mocks for
open
classes and members can also enable implicitly stubbing members like in Mockito, as long as the return types themselves are alsoopen
and can have mocks generated for them. While this may be more feasible with class mocks, it is not a goal of this proposal.The text was updated successfully, but these errors were encountered: