All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eclipsesource.restfuse.annotation.Context Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2011 EclipseSource and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Holger Staudacher - initial API and implementation
 ******************************************************************************/ 
package com.eclipsesource.restfuse.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.eclipsesource.restfuse.Destination;
import com.eclipsesource.restfuse.PollState;
import com.eclipsesource.restfuse.Response;


/**
 * The Context annotation can be used within a TestCase to get the 
 * {@link Response} or a {@link PollState} of an
 * HTTP request injected after it succeeds.

* *

A simple example looks like this: *

 * @RunWith( HttpJUnitRunner.class )
 * public class Example {
 * 
 *   @Rule
 *   public Destination destination = new Destination( "http://localhost" );
 *    
 *   @Context
 *   private Response response;
 * 
 *   @HttpTest( method = Method.GET, path = "/test" ) 
 *   public void testMethod() {
 *     com.eclipsesource.restfuse.Assert.assertAccepted( response );
 *   }
 * }
 * 
*

* * @see HttpTest * @see Destination */ @Retention( RetentionPolicy.RUNTIME ) @Target( { ElementType.FIELD } ) public @interface Context { // no content }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy