com.atlassian.webdriver.testing.rule
Class ClassInjectionRule<P extends TestedProduct<?>>

java.lang.Object
  extended by com.atlassian.webdriver.testing.rule.ClassInjectionRule<P>
All Implemented Interfaces:
InjectionContext, InjectingTestRule, org.junit.rules.TestRule

public final class ClassInjectionRule<P extends TestedProduct<?>>
extends Object
implements InjectingTestRule

Class injection rule. Access via InjectionRules.

Also implement InjectionContext for convenience in tests.

Since:
2.1

Method Summary
 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.
 void injectMembers(Object targetInstance)
          Execute injection of fields on given targetInstance
 void injectStatic(Class<?> targetClass)
          Execute injection of static fields on given targetClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
                                               org.junit.runner.Description description)
Specified by:
apply in interface org.junit.rules.TestRule

getInstance

@Nonnull
public <T> T getInstance(@Nonnull
                                 Class<T> type)
Description copied from interface: InjectionContext
Get an instance of given type from context.

Specified by:
getInstance in interface InjectionContext
Type Parameters:
T - type param
Parameters:
type - type of the requested instance
Returns:
an instance of requested type. An exception may be raised if the context is unable to instantiate given type.

injectStatic

public void injectStatic(@Nonnull
                         Class<?> targetClass)
Description copied from interface: InjectionContext
Execute injection of static fields on given targetClass.

Specified by:
injectStatic in interface InjectionContext
Parameters:
targetClass - class to inject into

injectMembers

public void injectMembers(@Nonnull
                          Object targetInstance)
Description copied from interface: InjectionContext
Execute injection of fields on given targetInstance

Specified by:
injectMembers in interface InjectionContext
Parameters:
targetInstance - instance to inject into


Copyright © 2014 Atlassian. All rights reserved.