/** * Removes all instrumentation point from the given types. * * @param types * to remove instrumentation points * @return types from which instrumentation points have been removed */ public Collection<? extends ImmutableClassType> removeInstrumentationPoints(final Collection<? extends ImmutableType> types) { return removeInstrumentationPoints(types, Collections.<IInstrumentationApplier> singleton(RemoveAllInstrumentationApplier.getInstance())); }
@Test public void returnFalse() { boolean result = applier.addInstrumentationPoints(agentConfiguration, classType); assertThat(result, is(false)); verifyZeroInteractions(agentConfiguration, classType); } }
@Test(expectedExceptions = NullPointerException.class) public void nullClass() { try { when(classType.hasInstrumentationPoints()).thenReturn(false); applier.removeInstrumentationPoints(null); } finally { verifyZeroInteractions(classType, methodType); } } }
@Test public void returnNull() { AbstractClassSensorAssignment<?> result = applier.getSensorAssignment(); assertThat(result, is(nullValue())); } }
@Test public void noInstrumentationPoints() { when(classType.hasInstrumentationPoints()).thenReturn(false); boolean result = applier.removeInstrumentationPoints(classType); assertThat(result, is(false)); verify(classType).hasInstrumentationPoints(); verifyNoMoreInteractions(classType); }
@Test public void notNull() { RemoveAllInstrumentationApplier instance = RemoveAllInstrumentationApplier.getInstance(); assertThat(instance, is(not(nullValue()))); } }
@Test public void removeInstrumentationPoints() { when(classType.hasInstrumentationPoints()).thenReturn(true); when(classType.getMethods()).thenReturn(Sets.newHashSet(methodType)); boolean result = applier.removeInstrumentationPoints(classType); assertThat(result, is(true)); verify(classType).hasInstrumentationPoints(); verify(classType).getMethods(); verify(methodType).setMethodInstrumentationConfig(null); verifyNoMoreInteractions(classType, methodType); }