@Test public void method() { long id = 7L; String name = "method"; String desc = "()V"; boolean enhancedExceptionSensor = false; when(sensorInstrumentationPoint.isConstructor()).thenReturn(false); when(sensorInstrumentationPoint.getId()).thenReturn(id); MethodVisitor methodVisitor = factory.getMethodVisitor(sensorInstrumentationPoint, superMethodVisitor, 0, name, desc, enhancedExceptionSensor); assertThat(methodVisitor, is(instanceOf(MethodInstrumenter.class))); MethodInstrumenter methodInstrumenter = (MethodInstrumenter) methodVisitor; assertThat(methodInstrumenter.getMethodId(), is(id)); assertThat(methodInstrumenter.isEnhancedExceptionSensor(), is(enhancedExceptionSensor)); }
@Test public void methodEnchancedExceptionSensor() { long id = 7L; String name = "method"; String desc = "()V"; boolean enhancedExceptionSensor = true; when(sensorInstrumentationPoint.isConstructor()).thenReturn(false); when(sensorInstrumentationPoint.getId()).thenReturn(id); MethodVisitor methodVisitor = factory.getMethodVisitor(sensorInstrumentationPoint, superMethodVisitor, 0, name, desc, enhancedExceptionSensor); assertThat(methodVisitor, is(instanceOf(MethodInstrumenter.class))); MethodInstrumenter methodInstrumenter = (MethodInstrumenter) methodVisitor; assertThat(methodInstrumenter.getMethodId(), is(id)); assertThat(methodInstrumenter.isEnhancedExceptionSensor(), is(enhancedExceptionSensor)); }