2
votes

Simple question. I'm trying to test in midje if my method triggers an exception. I could only find something like the following in the midje documentation.

(fact "Should throw a RuntimeException"
               (my-method! anything) =throws=> (RuntimeException.)

Thanks.

1
Apart from the small syntax error, isn't that what you want? The documentation says (fact (explosion) => (throws Exception)) - Assen Kolov
Yes, that's correct. Thank you. - Neikon

1 Answers

2
votes

Never mind. I found it.

(fact "Should throw a RuntimeException"
           (my-method! anything) => (throws RuntimeException)

That works for me.