SimpleSignal extends AbstractSignal<SimpleSignal.Listener> { @Override public void dispatch(Object... values) throws IllegalArgumentException { if (values.length != valueClasses.length) { throw new IllegalArgumentException("Incorrect number of arguments."); } for (int i = 0; i < values.length; ++i) { if (values[i] != null && values[i].getClass() != valueClasses[i]) { throw new IllegalArgumentException(); } } super.dispatch(values); } SimpleSignal(Object... classes); @Override void dispatch(Object... values);  }
@Test(expected = IllegalArgumentException.class) public void dispatch_error() throws Exception { SimpleSignal signal = new SimpleSignal(int.class, char.class); signal.dispatch(1, 2); }