org.jmockring.annotation.ContextDefaults Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmockring-core Show documentation
Show all versions of jmockring-core Show documentation
jmockring - Java test MOCKing tool for spRING.
A test harness tool for projects using the following technology stack:
- Java 6+
- Spring 3.1 or greater as a DI/Deployment container
- JUnit 4 and Mockito for testing
- Jetty/Servlet API 3.0 for web app (war) deployment - for testing only
Main features:
1) Partial Spring context deployment with automatic bean mocking for unavailable beans
2) Bootstrapping embedded Jetty server via JUnit runners
3) Configurable web application contexts
4) Automatic injection of Spring beans and mocks in JUnit tests via Java5 annotations
The newest version!
package org.jmockring.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.jmockring.webserver.WebServer;
/**
* Declare default values at class level.
*
* This helps avoid repeating the configuration settings in the annotations used to inject remote resources into the test class, such as
* {@link RemoteBean}, {@link RemoteMock}, {@link RemoteSpring}, {@link RemoteRequestListener}, etc ...
*
* @author Pavel Lechev
* @date 21/04/13
*/
@Target(ElementType.TYPE)
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface ContextDefaults {
String contextPath();
Class extends WebServer> bootstrap();
String executionName() default Server.DEFAULT_EXECUTION_NAME;
@ContextDefaults(contextPath = "", bootstrap = WebServer.class, executionName = Server.DEFAULT_EXECUTION_NAME)
final class DEFAULTS {
public static final ContextDefaults get() {
return DEFAULTS.class.getAnnotation(ContextDefaults.class);
}
}
}