Fork me on GitHub
#testing
<
2017-03-21
>
olfal20:03:16

Hi! What would be the best way to implement a stub of the form “throw X, when Y” in a unit test? In Java with Mockito, this would be the equivalent https://static.javadoc.io/org.mockito/mockito-core/2.7.19/org/mockito/Mockito.html#12

olfal20:03:56

If you know of any lib/framework that already does this, it would be great 🙂

olfal20:03:48

I finally managed to implement it using with-redefs. It works well but is not very elegant imo.