ComponentEventCallback handler = mockComponentEventHandler();
Component component = mockComponent();
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", new String[]{"27"}, handler, null);
event.setSource(component, "foo.Bar.baz()");
try
{
event.coerceContext(1, "java.lang.Integer");
}
catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(),
"Method foo.Bar.baz() has more parameters than there are context values for this component event.");