Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink ThenFactory #5

Closed
theangrydev opened this issue Oct 14, 2016 · 3 comments
Closed

Rethink ThenFactory #5

theangrydev opened this issue Oct 14, 2016 · 3 comments

Comments

@theangrydev
Copy link
Owner

In practise, the thens assert on not only the response from the when, but also other state such as database interactions and wiremock verifications. There might be a better way of modelling this, because currently there will be ThenFactory implementations that just ignore the response parameter entirely, which is a smell.

theangrydev added a commit that referenced this issue Oct 14, 2016
… rather than a response now. This is to help with the problems mentioned in #5 where the thens assert on more than just the direct result of a when, but also things like database state
@theangrydev
Copy link
Owner Author

One way to solve this would be to encourage a test result type that encapsulates the direct result of the when (e.g. a HTTP response) and also other kinds of state. That way, all ThenFactory would always need the same parameter. This could include e.g. HTTP response, database state and wiremock state.

@theangrydev
Copy link
Owner Author

Another issue with ThenFactory is when e.g. a wiremock verification needs to be built up. This can't be chained as then(something).hasFoo(1).hasBar(2) because the wiremock verification has to be one blob assertion. A workaround is to have a ThenFactory that is a builder and do something like then(something.hasFoo(1).hasBar(2)) but this is a bit dodgy, there might be a better way?

theangrydev added a commit that referenced this issue Oct 14, 2016
…rfaces, some that can be chained as then(something.foo(1).bar(2)) and others as then(something).foo(1).bar(2)
@theangrydev
Copy link
Owner Author

Implemented in 4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant