Asserts an exception has been thrown.