List of usage examples for org.springframework.aop.interceptor PerformanceMonitorInterceptor PerformanceMonitorInterceptor
public PerformanceMonitorInterceptor(boolean useDynamicLogger)
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());// w w w . ja v a2 s. 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 www. jav a 2 s. co m interceptor.invokeUnderTrace(mi, log); fail("Must have propagated the IllegalArgumentException."); } catch (IllegalArgumentException expected) { } verify(log).trace(anyString()); }