List of usage examples for org.springframework.aop.interceptor PerformanceMonitorInterceptor invokeUnderTrace
@Override protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable
From source file:org.springframework.aop.interceptor.PerformanceMonitorInterceptorTests.java
@Test public void testSunnyDayPathLogsPerformanceMetricsCorrectly() throws Throwable { MethodInvocation mi = mock(MethodInvocation.class); given(mi.getMethod()).willReturn(String.class.getMethod("toString", new Class[0])); Log log = mock(Log.class); PerformanceMonitorInterceptor interceptor = new PerformanceMonitorInterceptor(true); interceptor.invokeUnderTrace(mi, log); verify(log).trace(anyString());//from w w w .j av a2s . c om }
From source file:org.springframework.aop.interceptor.PerformanceMonitorInterceptorTests.java
@Test public void testExceptionPathStillLogsPerformanceMetricsCorrectly() throws Throwable { MethodInvocation mi = mock(MethodInvocation.class); given(mi.getMethod()).willReturn(String.class.getMethod("toString", new Class[0])); given(mi.proceed()).willThrow(new IllegalArgumentException()); Log log = mock(Log.class); PerformanceMonitorInterceptor interceptor = new PerformanceMonitorInterceptor(true); try {/*from w w w .ja v a2 s. com*/ interceptor.invokeUnderTrace(mi, log); fail("Must have propagated the IllegalArgumentException."); } catch (IllegalArgumentException expected) { } verify(log).trace(anyString()); }