Hey Ed -
I added code review comments to the issue:
http://java.net/jira/browse/JAVASERVERFACES-1542
Regarding:
On Fri, May 6, 2011 at 5:33 PM, Ed Burns <edward.burns_at_oracle.com> wrote:
> The only controversial bit about this is what I did to cause the
> InterruptedException to be thrown at my behest during a testcase. I
> used reflection to set a field that the runtime checks to see if it
> should throw the exception.
Think this is okay, though I am confused about how the timing of the
test case will work. As far as I can tell:
- The exception is thrown from the FactoryManager constructor when the
"throwInterruptedException" flag is set to true.
- This flag is set to true in response to a commandButton click.
- By the time the commandButton click occurs, the FactoryManager has
already been initialized.
As a result, it seems that we won't see the InterruptedException - ie.
the FactoryManager constructor is called before the flag is set.
Or am I missing something more subtle that is happening in the test case/code?
> If anyone can suggest a better way to do
> this, I'd really appreciate it.
Jason Porter demonstrated a way to do this (ie. to instrument code to
throw exceptions at particular points in time) in his Seam Catch
presentation last week at JUDCon. The trick is to use Byteman:
http://www.jboss.org/byteman
Not sure if that is an option here, but it is a very cool solution to
exactly this problem!
Andy