This test will succeed if no exception is thrown. I'd recommend adding a then((_) => ...) that just expects to fail.