Edit 05/02/2010: I'd now recommend using FlexUnit 4. It uses an extensible metdata system, supports expected exceptions, and also supports running in an integration server environment without the use of AIR.
Edit: You should have a look at fluint, which was built by people who had enough of FlexUnit and it's limitations. It might have some of these types of assertions built in.
I totally agree. In fact, FlexUnit is missing several useful methods (assertEvent, assertArrayEquals, etc). I know you said you know how to implement it, but feel free to use mine:
public static function assertError(message : String, func : Function, errorClass : Class = null, errorMessage : String = null, errorCodes : Array = null) : Error
{
_assertionsMade++;
if (errorClass == null) errorClass = Error;
try
{
func();
}
catch(ex : Error)
{
if (!(ex is errorClass))
{
fail("Expected error of type '" + getQualifiedClassName(errorClass) + "' but was '" + getQualifiedClassName(ex) + "'");
}
if (errorMessage != null && ex.message != errorMessage)
{
fail("Expected error with message '" + errorMessage + "' but was '" + ex.message + "'");
}
if (errorCodes != null && errorCodes.indexOf(ex.errorID) == -1)
{
fail("Expected error with errorID '" + errorCodes.join(" or ") + "' but was '" + ex.errorID + "'");
}
return ex;
}
if (message == null)
{
message = "Expected error of type '" + getQualifiedClassName(errorClass) + "' but none was thrown"
}
fail(message);
return null;
}