Closed rlbisbe closed 6 years ago
Hey Roberto,
I've submitted a new PR with the changes we talked about above (unfortunately, I can't update your PR). Can we move the discussion there? #6
Thanks, Adam
I'm closing this one in favor of #6 which was merged. Thanks again!
Hey Roberto,
firstly, thanks a ton for the contribution!
In general, it looks good. One idea that I had that I wanted to run past you is changing the API slightly to allow more assertions on the exception from
shouldThrow
than the message.My idea was to
shouldThrow
return a mutable object (let's call itExceptionAssertion
). It would have a bunch of methods that all returnthis
and each add another condition that the thrown Exception has to satisfy. In code:This allows you to easily add other Exception assertions to the
ExceptionAssertion
class without adding more methods to the mainSpecBuilder
interface. Some possible examples, inspired by AssertJ's Exception assertions:withMessageContaining("\"long\"")
withMessageStartingWith("For input string: ")
withNoCause()
withCause().withMessage("sth")
etc. etc.
Thoughts on this idea?