@Test public void testIntercept() throws Exception { final FrenchConnection frenchConnection = spy(new FrenchConnection(connection)); final Method createStatement = Connection.class.getMethod("createStatement"); ConnectionInterceptor.intercept(createStatement, frenchConnection, new Object[]{}); verify(connection).createStatement(); verifyNoMoreInteractions(connection); }
@RuntimeType public static Object intercept(@Origin(cache = true) Method method, @This ConnectionProxy delegator, @AllArguments Object[] arguments) throws Exception { try { return method.invoke(delegator.getDelegatedConnection(), arguments); } catch (Exception e) { if(e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } else { throw e; } } }
ConnectionInterceptor { @RuntimeType public static Object intercept(@Origin(cache = true) Method method, @This ConnectionProxy delegator, @AllArguments Object[] arguments) throws Exception { try { return method.invoke(delegator.getDelegatedConnection(), arguments); } catch (Exception e) { if(e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } else { throw e; } } } }
ConnectionInterceptor { @RuntimeType public static Object intercept(@Origin(cache = true) Method method, @This ConnectionProxy delegator, @AllArguments Object[] arguments) throws Exception { try { return method.invoke(delegator.getDelegatedConnection(), arguments); } catch (Exception e) { if(e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } else { throw e; } } } private  ConnectionInterceptor(); }
ConnectionInterceptor { @RuntimeType public static Object intercept(@Origin(cache = true) Method method, @This ConnectionProxy delegator, @AllArguments Object[] arguments) throws Exception { try { return method.invoke(delegator.getDelegatedConnection(), arguments); } catch (Exception e) { if(e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } else { throw e; } } } private  ConnectionInterceptor(); static void close(); @RuntimeType static Object intercept(@Origin(cache = true) Method method,
                                   @This ConnectionProxy delegator,
                                   @AllArguments Object[] arguments); }
ConnectionInterceptor { @RuntimeType public static Object intercept(@Origin(cache = true) Method method, @This ConnectionProxy delegator, @AllArguments Object[] arguments) throws Exception { try { return method.invoke(delegator.getDelegatedConnection(), arguments); } catch (Exception e) { if(e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } else { throw e; } } } private  ConnectionInterceptor(); static void close(); @RuntimeType static Object intercept(@Origin(cache = true) Method method,
                                   @This ConnectionProxy delegator,
                                   @AllArguments Object[] arguments);  }