Class MockitoService

java.lang.Object
org.jvnet.testing.hk2mockito.internal.MockitoService

@Service public class MockitoService extends Object
A helper service for creating SUT, SC, MC or regular service.
Author:
Sharmarke Aden
  • Method Details

    • findOrCreateSUT

      public Object findOrCreateSUT(Injectee injectee, ServiceHandle<?> root)
      Given an SUT annotation and an injectee resolve the service associated with the injectee and use the metadata in the SUT annotation to possibly create a mockito spy.
      Parameters:
      injectee - The injection point this value is being injected into
      root - The service handle of the root class being created
      Returns:
      the service or a proxy spy of the service
    • createOrFindService

      public Object createOrFindService(Injectee injectee, ServiceHandle<?> root)
      Given an injectee create and cache or resolve the service associated with it.
      Parameters:
      injectee - The injection point this value is being injected into
      root - The service handle of the root class being created
      Returns:
      the service or a proxy spy or mock of the service
    • findOrCreateCollaborator

      public Object findOrCreateCollaborator(int position, String fieldName, Injectee injectee, ServiceHandle<?> root)
      Given metadata about collaborator and an injectee create or resolve the collaborating service.
      Parameters:
      position - method or constructor the parameter position metadata
      fieldName - field name metadata
      injectee - The injection point this value is being injected into
      root - The service handle of the root class being created
      Returns:
      the service or a proxy spy or mock of the service