Wrap test.throws calls in anonymous functions for correct usage