Skip to content

Commit

Permalink
Enforced order of tests. This is not necessary now, but might be in f…
Browse files Browse the repository at this point in the history
…uture tests.
  • Loading branch information
enridaga committed Dec 29, 2015
1 parent f0eda80 commit fbdc8ba
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions it/src/test/java/uk/ac/open/kmi/basil/it/CollectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,40 @@

import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runners.MethodSorters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class CollectionTest extends BasilTestBase {
private static final Logger log = LoggerFactory.getLogger(CollectionTest.class);

@Rule
public TestName name = new TestName();

@Test
public void getAskAnyGetJson() throws ParseException, ClientProtocolException, IOException {
log.info("IT#{}", name.getMethodName());
public void askAnyGetJson() throws ParseException, ClientProtocolException, IOException {
log.info("#{}", name.getMethodName());
executor.execute(builder.buildGetRequest("/basil").withHeader("Accept", "*/*"));
log.debug(" ... returned content: {}", executor.getContent());
executor.assertStatus(200)
.assertContentType("application/json").assertContentRegexp("\\{.*\\}");
executor.assertStatus(200).assertContentType("application/json").assertContentRegexp("\\{.*\\}");
}

@Test
public void getAskJsonGetJson() throws ParseException, ClientProtocolException, IOException {
log.info("IT#{}", name.getMethodName());
public void askJsonGetJson() throws ParseException, ClientProtocolException, IOException {
log.info("#{}", name.getMethodName());
executor.execute(builder.buildGetRequest("/basil").withHeader("Accept", "application/json"));
log.debug(" ... returned content: {}", executor.getContent());
executor.assertStatus(200).assertContentType("application/json").assertContentRegexp("\\{.*\\}");
}

@Test
public void getAskHtmlGet406() throws ParseException, ClientProtocolException, IOException {
log.info("IT#{}", name.getMethodName());
public void askHtmlGet406() throws ParseException, ClientProtocolException, IOException {
log.info("#{}", name.getMethodName());
executor.execute(builder.buildGetRequest("/basil").withHeader("Accept", "application/any"));
log.debug(" ... returned content: {}", executor.getContent());
executor.assertStatus(406);
Expand Down

0 comments on commit fbdc8ba

Please sign in to comment.