public final class ClassInjectionRule<P extends TestedProduct<?>> extends Object implements InjectingTestRule
InjectionRules.
Also implement InjectionContext for convenience in tests.| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
<T> T |
getInstance(Class<T> type)
Get an instance of given type from context.
|
<T> T |
inject(T target)
Execute injection of fields on
targetInstance |
void |
injectMembers(Object targetInstance)
Execute injection of fields on given targetInstance
|
void |
injectStatic(Class<?> targetClass)
Execute injection of static fields on given targetClass.
|
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRule@Nonnull public <T> T getInstance(@Nonnull Class<T> type)
InjectionContextgetInstance in interface InjectionContextT - type paramtype - type of the requested instancepublic void injectStatic(@Nonnull Class<?> targetClass)
InjectionContextinjectStatic in interface InjectionContexttargetClass - class to inject intopublic void injectMembers(@Nonnull Object targetInstance)
InjectionContextinjectMembers in interface InjectionContexttargetInstance - instance to inject into@Nonnull public <T> T inject(@Nonnull T target)
InjectionContexttargetInstanceinject in interface InjectionContexttarget - instance to inject intoCopyright © 2015 Atlassian. All rights reserved.