Skip to content

Commit

Permalink
Added Custom Header example
Browse files Browse the repository at this point in the history
  • Loading branch information
hstaudacher committed Jul 24, 2012
1 parent f6de37f commit 7547cbd
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
******************************************************************************/
package com.eclipsesource.restfuse.example;

import static com.eclipsesource.restfuse.Assert.assertOk;

import org.junit.Rule;
import org.junit.runner.RunWith;

import com.eclipsesource.restfuse.Destination;
import com.eclipsesource.restfuse.HttpJUnitRunner;
import com.eclipsesource.restfuse.Method;
import com.eclipsesource.restfuse.PollState;
import com.eclipsesource.restfuse.Response;
import com.eclipsesource.restfuse.annotation.Context;
import com.eclipsesource.restfuse.annotation.Header;
import com.eclipsesource.restfuse.annotation.HttpTest;
import com.eclipsesource.restfuse.annotation.Poll;

Expand All @@ -30,11 +34,21 @@ public class PollTest {

@Context
private PollState pollState;

@Context
private Response response;

@HttpTest( method = Method.GET, path = "/" )
@Poll( times = 5, interval = 2000 )
@Poll( times = 3, interval = 2000 )
public void checkRestfuseOnlineStatus() {
System.out.println( "Attemt " + pollState.getTimes() );
System.out.println( pollState.getTimes() + ". Responsecode = " + pollState.getResponse( pollState.getTimes() ).getStatus() );
}

@HttpTest( method = Method.GET,
path = "/",
headers = { @Header( name = "Accepted-Language", value = "en-en" ) } )
public void checkRestfuseOnlineStatusWithHeader() {
assertOk( response );
}
}

0 comments on commit 7547cbd

Please sign in to comment.