In the RaiseAssert test library, how to best asser...
# arrow
d
In the RaiseAssert test library, how to best assert that a tested method throws an exception of a certain type, without actually checking against the full exception instance? Currently, I'm doing this
Copy code
RaiseAssert.assertThat { ... }.isEqualTo(RaiseResult.FailureWithException(...))
but that requires specifying the full exception instance, not just its type. EDIT: I now see that there indeed is an
isInstanceOf
method. Sorry.
arrow intensifies 1
❤️ 1
r
Are you using the
assertj-arrow-core
testing library?
What do you think about it?
d
Yes, I've been using that library for a short time. So far I used only simple stuff, mostly mimicking the assertj conventions. I would just appreciate more inline documentation of the top-level methods (e.g.
assertThatThrownBy
)
arrow intensifies 1
👍 1
r
Ok, thanks for the feedback. I'll try to add more documentation ❤️
David, I released version 1.2.1 of the library. I tried to add some more doc. Let me know if it’s what you asked for 🙂
d
Yes, that's better! It might be worth mentioning, though, that assertThatRaisedBy propagates the possible exception. And also that it throws an exception if the block succeeds. But this is really a small detail.
🙏 1
👍 1
❤️ 1