PrintStream stdout = System.out;
try {
ByteArrayOutputStream tmpOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(tmpOut));
OverloadDispatcherGenerator gen = new OverloadDispatcherGenerator(B.class);
OverloadDispatcher dispatcher = (OverloadDispatcher) gen.generate().newInstance();
B b = new B();
dispatcher.dispatchEvent(b, new Event1());
String output = tmpOut.toString().trim();
// use DOTALL to ignore previous lines in output debug mode
Assert.assertTrue(Pattern.compile("^.+OverloadDispatcher\\d+ - Cannot dispatch event "