Fixing expected exception in tests