lithium.classloadertest.annotation.TestVisible Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multiverse-test Show documentation
Show all versions of multiverse-test Show documentation
The Multiverse Test Framework for Java
The newest version!
package lithium.classloadertest.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import lithium.classloadertest.FunctionalTestClassLoader;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Marks a field in a test class to be available for proxied calls from a "test" classloader to a "child" classloader
* created with {@link FunctionalTestClassLoader}.
*
* This annotation is designed for cases when Spring is being used and there are injected {@link Autowired} Spring fields
* in the test class that need to be automatically copied up from the child classloader to the parent for easy manipulation.
*
* Example:
*
* @TestVisible
* @Autowired
* private final MyInterface myDependencyInjectedValue = null;
*
* ...
* {
* ...
* myTestClass.myDependencyInjectedValue.getValue();
* ...
* }
*
* @author jeff.collins
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface TestVisible {
}