private <T> T createProxy(TestLifecycleHandler h, Class<T> type) { Object o = Proxy.newProxyInstance(h.getClass().getClassLoader(), new Class<?>[] {type}, h); if (!type.isAssignableFrom(o.getClass())) { throw new RuntimeException(o.getClass().toString() + " vs " + type); } return (T) o; }
public boolean checkHandlerHasBeenInvoked(HandlerType type, int i) { TestLifecycleHandler h = mapping.get(type); return h.wasCalled(i); }