ReflectionUtil { public static <A, B extends A> void run(Class<A> c, B o) { runInternal(c.getMethods(), o); } private  ReflectionUtil(); static A call(Object expression); static void run(Class<A> c, B o); static void run(A a);  }
@Test public void testRun() { final int[] counter = {2}; run(Bla.class, new Bla() { @Override public String getId() { counter[0]--; return null; } @Override public int calc(int v) { counter[0]--; return 0; } }); assertEquals(1, counter[0]); }
@Test public void testRun2() { final int[] counter = {2}; run(new Bla() { @Override public String getId() { counter[0]--; return null; } @Override public int calc(int v) { counter[0]--; return 0; } }); assertEquals(1, counter[0]); }