A quick way to test thrown errors are behaving as expected.[Test]
public function testErrorHandling():void
{
var errorThrown:Boolean = false;
try
{
callMethodThatCausesError();
}
catch (e:Error)
{
errorThrown = (e.message == 'SomeClass.ERROR_IN_DATA_MESSAGE');
}
assertTrue(errorThrown);
}
public function testErrorHandling():void
{
var errorThrown:Boolean = false;
try
{
callMethodThatCausesError();
}
catch (e:Error)
{
errorThrown = (e.message == 'SomeClass.ERROR_IN_DATA_MESSAGE');
}
assertTrue(errorThrown);
}
No comments:
Post a Comment