Checking for exceptions

With Midje, we can check whether a certain exception is being thrown in our code:

(fact "Passing a number throws an exception" 
(non-blank? 1234) => (throws ClassCastException))

The auto-runner tells us that our test checking ClassCastException was implemented correctly:

==================================================================
Loading (testing-example.midje-tests)
nil
All checks (9) succeeded