Closed
Description
Q | A |
---|---|
Bug? | no |
New Feature? | yes |
Version | n/a |
Actual Behavior
Currently, when using the Client
and configuring matchers using on
()
- iterates over all matchers and returns the response or throws the exception from the matching matcher
- throws an exception (when available) from the queue of exceptions previously added
- returns a response (when available) from the queue of responses previously added
- throws a default exception when no request matcher matched the outgoing request and a default exception has been set
- returns a default response when no request matcher matched the outgoing request and no default exception, but a default response has been set
- returns a response created by the composed request factory when no request matcher matched the outgoing request and neither a default exception nor a default response have been set
This is fine, but what if we expect a specific sequence of requests to be sent with matching responses? If we use use the Client
as it is right now, it's of course possible to define such a sequence.
However, the order in which request are sent does not matter.
What do you think about introducing a StrictClient
, that allows specifying an exact sequence of matchers, and that
- allows introspecting in the assert phase whether all expected requests have been sent (the (the sequence has been completed)
- throws a specific exception in the act phase when - given a configured sequence of requests - an unexpected request has been sent
I think this could also nicely cover #36.
What do you think?
Possible Solutions
I would of course propose a PR if you think such a feature would be a nice addition.
🤓
Metadata
Metadata
Assignees
Labels
No labels