Change exception type in tests