@BeforeMethod public void setReturnValueDescriptor() { when(sip.getSubstitutionDescriptor()).thenReturn(new SubstitutionDescriptor(true, false)); }
@BeforeMethod public void setReturnValueDescriptor() { when(sip.getSubstitutionDescriptor()).thenReturn(new SubstitutionDescriptor(false, false)); }
@BeforeMethod public void setReturnValueDescriptor() { when(sip.getSubstitutionDescriptor()).thenReturn(new SubstitutionDescriptor(false, true)); }
@BeforeMethod public void setReturnValueDescriptor() { when(sip.getSubstitutionDescriptor()).thenReturn(new SubstitutionDescriptor(true, true)); }
@Test public void specialMethod() { long id = 7L; String name = "method"; String desc = "()V"; boolean enhancedExceptionSensor = false; SubstitutionDescriptor substitutionDescriptor = mock(SubstitutionDescriptor.class); when(specialInstrumentationPoint.getId()).thenReturn(id); when(specialInstrumentationPoint.getSubstitutionDescriptor()).thenReturn(substitutionDescriptor); MethodVisitor methodVisitor = factory.getMethodVisitor(specialInstrumentationPoint, superMethodVisitor, 0, name, desc, enhancedExceptionSensor); assertThat(methodVisitor, is(instanceOf(SpecialMethodInstrumenter.class))); }
@Override public MethodVisitor answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); SpecialInstrumentationPoint sip = (SpecialInstrumentationPoint) arguments[0]; return getSpecialMethodInstrumenter((MethodVisitor) arguments[1], (Integer) arguments[2], (String) arguments[3], (String) arguments[4], sip.getId(), sip.getSubstitutionDescriptor()); } };
return new SpecialMethodInstrumenter(superMethodVisitor, access, name, desc, specialInstrumentationPoint.getId(), specialInstrumentationPoint.getSubstitutionDescriptor());
assertThat(ssc.getId(), is(methodId)); assertThat(ssc.getSensorId(), is(sensorId)); assertThat(ssc.getSubstitutionDescriptor(), is(substitutionDescriptor)); assertThat(instrumentationConfig.getSensorInstrumentationPoint(), is(nullValue()));