I'm writing some unit tests for a Generator.  The standard practice
for handling errors in Generators seems to be to log an error message
to the logger and then throw an UnableToCompleteException.  Unit
testing the proper handling of errors like these seems tricky for a
couple reasons.

Catching the UnableToCompleteException doesn't actually tell you
anything about what error occured.  Assuming multiple
UnableToCompleteExceptions can be thrown in response to various error
handling cases, some method is needed to verify that the proper error
case was handled.

My first reaction was just to subclass UnableToCompleteException with
a specific exception type, but the documentation for
UnableToCompleteException seems to imply that all error context should
sent to the logger.  Additionally, it seems likely that a higher-level
error handler might consume any underlying exception thrown, log the
high-level error and throw a new UnableToCompleteException, throwing
awaythe underlying context.

Any ideas?  Best practices?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to