Search in sources :

Example 1 with MockTraceContext

use of com.navercorp.pinpoint.test.mock.MockTraceContext in project pinpoint by naver.

the class BeanMethodInterceptorTest method testAfter.

@Test
public void testAfter() throws Exception {
    final MockTraceContext traceContext = new MockTraceContext();
    final Trace trace = Mockito.mock(Trace.class);
    traceContext.setTrace(trace);
    final SpanEventRecorder recorder = Mockito.mock(SpanEventRecorder.class);
    Mockito.when(trace.currentSpanEventRecorder()).thenReturn(recorder);
    final BeanMethodInterceptor beanMethodInterceptor = new BeanMethodInterceptor(traceContext, true);
    Object thisObject = new Object();
    final Exception throwable = new Exception();
    beanMethodInterceptor.after(thisObject, 10, null, null, throwable);
    Mockito.verify(recorder, times(1)).recordException(true, throwable);
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) MockTraceContext(com.navercorp.pinpoint.test.mock.MockTraceContext) Test(org.junit.Test)

Aggregations

SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)1 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)1 MockTraceContext (com.navercorp.pinpoint.test.mock.MockTraceContext)1 Test (org.junit.Test)1