If I have
class ErrorThrower{
void throwAnError(String argument){
throw new Error();
}
}
I want to test if throwAnError throws Exception, or more precisely an instance of Error
This is my code but it doesn't work
test('', () {
var errorThrower = new ErrorThrower();
expect(errorThrower.throwAnError("string"), throwsException);
});
Aucun commentaire:
Enregistrer un commentaire