expect(context.get(Integer.class, 0)).andThrow(new NumberFormatException("Not so easy, is it?"));
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, resources, logger);
event.setMethodDescription("foo.Bar.baz()");
try
{
event.coerceContext(0, "java.lang.Integer");
unreachable();
} catch (IllegalArgumentException ex)
{
// Different JVMs will report the conversion error slightly differently,
// so we don't try to check that part of the error message.