Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mockito.internal.configuration.injection
Class ConstructorInjection

    java.lang.Object
      org.mockito.internal.configuration.injection.MockInjectionStrategy
          org.mockito.internal.configuration.injection.ConstructorInjection

    public class ConstructorInjection

extends MockInjectionStrategy

Injection strategy based on constructor.

The strategy will search for the constructor with most parameters and try to resolve mocks by type.

> TODO on missing mock type, shall it abandon or create "noname" mocks. TODO and what if the arg type is not mockable.

For now the algorithm tries to create anonymous mocks if an argument type is missing. If not possible the algorithm abandon resolution.

Constructor Summary
`ConstructorInjection()`

Method Summary
`boolean` | `processInjection(java.lang.reflect.Field field, java.lang.Object fieldOwner, java.util.Set<java.lang.Object> mockCandidates)` Process actual injection.

Methods inherited from class org.mockito.internal.configuration.injection.MockInjectionStrategy
`nop, process, thenTry`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConstructorInjection

    public ConstructorInjection()

Method Detail

### processInjection

    public boolean processInjection(java.lang.reflect.Field field,
                                    java.lang.Object fieldOwner,
                                    java.util.Set<java.lang.Object> mockCandidates)

  Description copied from class: `MockInjectionStrategy`
  Process actual injection.

  Don't call this method directly, instead call `MockInjectionStrategy.process(Field, Object, Set)`

  Specified by:
    `processInjection` in class `MockInjectionStrategy`
  Parameters:
    `field` - Field needing injection
    `fieldOwner` - Field owner instance.
    `mockCandidates` - Pool of mocks to inject.
  Returns:
    `true` if injection occurred, `false` otherwise

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD