Search in sources :

Example 1 with AroundInterceptor0

use of com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor0 in project pinpoint by naver.

the class InvokeAfterCodeGeneratorTest method testGenerate_AroundInterceptor0.

@Test
public void testGenerate_AroundInterceptor0() {
    final Class<AroundInterceptor0> aroundInterceptor3Class = AroundInterceptor0.class;
    final InterceptorDefinition interceptorDefinition = interceptorDefinitionFactory.createInterceptorDefinition(aroundInterceptor3Class);
    final InstrumentClass mockClass = mock(InstrumentClass.class);
    Mockito.when(mockClass.getName()).thenReturn("TestClass");
    final InstrumentMethod mockMethod = mock(InstrumentMethod.class);
    Mockito.when(mockMethod.getName()).thenReturn("TestMethod");
    Mockito.when(mockMethod.getParameterTypes()).thenReturn(new String[] {});
    Mockito.when(mockMethod.getReturnType()).thenReturn("java.lang.Object");
    ApiMetaDataService apiMetaDataService = mock(ApiMetaDataService.class);
    final InvokeAfterCodeGenerator invokeAfterCodeGenerator = new InvokeAfterCodeGenerator(100, interceptorDefinition, mockClass, mockMethod, apiMetaDataService, false, true);
    final String generate = invokeAfterCodeGenerator.generate();
    logger.debug("testGenerate_AroundInterceptor0:{}", generate);
    Assert.assertFalse(generate.contains("($w)$1"));
    Assert.assertFalse(generate.contains("($w)$2"));
    Assert.assertFalse(generate.contains("($w)$3"));
    Assert.assertTrue(generate.contains("$e"));
}
Also used : AroundInterceptor0(com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor0) InstrumentClass(com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass) InstrumentMethod(com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod) ApiMetaDataService(com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService) Test(org.junit.Test)

Aggregations

InstrumentClass (com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass)1 InstrumentMethod (com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod)1 AroundInterceptor0 (com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor0)1 ApiMetaDataService (com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService)1 Test (org.junit.Test)1