Stub API
Closed this issue · 1 comments
belka-ew commented
Stub API would be a subset of the available Mocking API, but without the support for the expectations.
Differences:
- The builder doesn't need
.verify
and.expect()
(but.stub()
) - There is actually no need to make it a member function of the
Mocker
since there is no need to track created stubs; sostub!Object()
can be a freestanding function - Stubbed class requires less generated code, since we can skip expectation checking
- Repositories, overloads and calls can probably use the same data structures
belka-ew commented
A draft ist written.
It is Mocker.stub()
so that the stub can use comparators set for the mocker.
Open questions:
.repeat
-functions aren't needed. It should be possible to use differentCall
s in stubs and mocks. Or.repeat
can be a noop which is less nice.- What happens if the given arguments don't match the set ones?
- If there is a stub call configured without the arguments at all, it can be used as fallback-
- if the
Call
queue is empty, return.init
.