Class ClassProxyFactory

java.lang.Object
org.easymock.internal.ClassProxyFactory
All Implemented Interfaces:
IProxyFactory

public class ClassProxyFactory extends Object implements IProxyFactory
Factory generating a mock for a class.
  • Field Details

  • Constructor Details

    • ClassProxyFactory

      public ClassProxyFactory()
  • Method Details

    • isCallerMockInvocationHandlerInvoke

      public static boolean isCallerMockInvocationHandlerInvoke(Throwable e)
    • createProxy

      public <T> T createProxy(Class<T> toMock, InvocationHandler handler, Method[] mockedMethods, ConstructorArgs args)
      Specified by:
      createProxy in interface IProxyFactory
      Type Parameters:
      T - type of the class to mock
      Parameters:
      toMock - the class to mock by the factory
      handler - the handler that will be linked to the created proxy
      mockedMethods - the subset of toMock's methods to mock, or null to mock all methods.
      args - the constructor arguments to use, or null to use heuristics to choose a constructor.
      Returns:
      the newly created proxy
    • doCreateProxy

      @IgnoreAnimalSniffer private <T> T doCreateProxy(Class<T> toMock, InvocationHandler handler, ClassInfoProvider provider, Method[] mockedMethods, ConstructorArgs args)
    • isJdkClassOrWithoutPackage

      private static <T> boolean isJdkClassOrWithoutPackage(Class<T> toMock)
    • classLoadingStrategy

      private net.bytebuddy.dynamic.loading.ClassLoadingStrategy<ClassLoader> classLoadingStrategy()
    • getInvocationHandler

      public InvocationHandler getInvocationHandler(Object mock)
      Description copied from interface: IProxyFactory
      Returns the invocation handler for mock;
      Specified by:
      getInvocationHandler in interface IProxyFactory
      Parameters:
      mock - a mock instance previously returned by createProxy.
      Returns:
      the handler handling method calls for the mock
    • getMockingData

      @IgnoreAnimalSniffer private static ClassMockingData getMockingData(Object mock)
    • getCallbackGetter

      private static MethodHandle getCallbackGetter(Object mock)
    • getCallbackSetter

      private static MethodHandle getCallbackSetter(Object mock)