@Test public void testIntegration() throws Exception { SleepInterceptor interceptor1 = new SleepInterceptor(100); SleepInterceptor interceptor2 = new SleepInterceptor(50); final UserAccount user = mock(UserAccount.class); DefaultInvocation invocation = new DefaultInvocation(new InvocationContext(user, "portfolioId", BigMoney.parse("GBP 1.23"), new Date()), ImmutableList.of(interceptor1, interceptor2)); InvocationProxy proxy = new InvocationProxy(invocation); ValidationCode resultCode = proxy.invoke(); assertThat(interceptor1.isRan(), is(true)); assertThat(interceptor2.isRan(), is(true)); assertThat(invocation.isExecuted(), is(true)); assertThat(resultCode, is(ValidationCode.SUCCESSFUL)); }
public ValidationCode invoke() { InvocationContext context = invocation.getInvocationContext(); ValidationCode code; try { code = invocation.invoke(); } finally { logger.info("Whole time : {} ", context.printProfiling()); } return code; }
InvocationProxy { public ValidationCode invoke() { InvocationContext context = invocation.getInvocationContext(); ValidationCode code; try { code = invocation.invoke(); } finally { logger.info("Whole time : {} ", context.printProfiling()); } return code; } }
InvocationProxy { public ValidationCode invoke() { InvocationContext context = invocation.getInvocationContext(); ValidationCode code; try { code = invocation.invoke(); } finally { logger.info("Whole time : {} ", context.printProfiling()); } return code; } InvocationProxy(Invocation invocation); }
InvocationProxy { public ValidationCode invoke() { InvocationContext context = invocation.getInvocationContext(); ValidationCode code; try { code = invocation.invoke(); } finally { logger.info("Whole time : {} ", context.printProfiling()); } return code; } InvocationProxy(Invocation invocation); ValidationCode invoke(); }
InvocationProxy { public ValidationCode invoke() { InvocationContext context = invocation.getInvocationContext(); ValidationCode code; try { code = invocation.invoke(); } finally { logger.info("Whole time : {} ", context.printProfiling()); } return code; } InvocationProxy(Invocation invocation); ValidationCode invoke();  }