Exemple #1
0
  public boolean areCapturedClasses(
      @Nonnull Class<?> mockedClass1, @Nonnull Class<?> mockedClass2) {
    for (CaptureTransformer<?> captureTransformer : captureTransformers) {
      if (captureTransformer.areCapturedClasses(mockedClass1, mockedClass2)) {
        return true;
      }
    }

    return false;
  }
Exemple #2
0
  public void removeCaptureTransformers(int previousTransformerCount) {
    int currentTransformerCount = captureTransformers.size();

    for (int i = currentTransformerCount - 1; i >= previousTransformerCount; i--) {
      CaptureTransformer<?> transformer = captureTransformers.get(i);
      transformer.deactivate();
      Startup.instrumentation().removeTransformer(transformer);
      captureTransformers.remove(i);
    }
  }
Exemple #3
0
  @Nullable
  public CaptureOfNewInstances findCaptureOfImplementations(@Nonnull Class<?> baseType) {
    for (CaptureTransformer<?> captureTransformer : captureTransformers) {
      CaptureOfNewInstances capture =
          captureTransformer.getCaptureOfImplementationsIfApplicable(baseType);

      if (capture != null) {
        return capture;
      }
    }

    return null;
  }