|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mockito.internal.configuration.injection.MockInjectionStrategy
public abstract class MockInjectionStrategy
Injector strategy contract
| Constructor Summary | |
|---|---|
MockInjectionStrategy()
|
|
| Method Summary | |
|---|---|
static MockInjectionStrategy |
nop()
NOP Strategy that will always try the next strategy. |
boolean |
process(java.lang.reflect.Field onField,
java.lang.Object fieldOwnedBy,
java.util.Set<java.lang.Object> mockCandidates)
Actually inject mockCandidates on field. |
protected abstract boolean |
processInjection(java.lang.reflect.Field field,
java.lang.Object fieldOwner,
java.util.Set<java.lang.Object> mockCandidates)
Process actual injection. |
MockInjectionStrategy |
thenTry(MockInjectionStrategy strategy)
Enqueue next injection strategy. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockInjectionStrategy()
| Method Detail |
|---|
public static final MockInjectionStrategy nop()
public MockInjectionStrategy thenTry(MockInjectionStrategy strategy)
The implementation should take care of the actual calling if required.
strategy - Queued strategy.
public boolean process(java.lang.reflect.Field onField,
java.lang.Object fieldOwnedBy,
java.util.Set<java.lang.Object> mockCandidates)
Actual algorithm is defined in the implementations of processInjection(Field, Object, Set).
However if injection occurred successfully, the process should return true,
and false otherwise.
The code takes care of calling the next strategy if available and if of course if required
onField - Field needing injection.fieldOwnedBy - The owning instance of the field.mockCandidates - A set of mock candidate, that might be injected.
true if successful, false otherwise.
protected abstract boolean processInjection(java.lang.reflect.Field field,
java.lang.Object fieldOwner,
java.util.Set<java.lang.Object> mockCandidates)
Don't call this method directly, instead call process(Field, Object, Set)
field - Field needing injectionfieldOwner - Field owner instance.mockCandidates - Pool of mocks to inject.
true if injection occurred, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||