package uk.ac.ebi.atlas.experiments;

import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Response;
import org.junit.Test;
import uk.ac.ebi.atlas.acceptance.rest.fixtures.RestAssuredFixture;

import java.util.List;

import static com.jayway.restassured.RestAssured.get;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;

public class ExperimentsSIT extends RestAssuredFixture {

    @Test
    public void numberOfExperiments(){
        Response response = get("/json/experiments");

        response.then().assertThat().statusCode(200);
        response.then().assertThat().contentType(ContentType.JSON);

        List<String> accessions = response.jsonPath().get("aaData.experimentAccession");

        assertThat(accessions, hasSize(NumberOfExperiments.ALL));
    }

    @Test
    public void hasProteomicsExperiment_E_PROT_1(){
        Response response = get("/json/experiments");

        response.then().assertThat().statusCode(200);
        response.then().assertThat().contentType(ContentType.JSON);

        List<String> accessions = response.jsonPath().get("aaData.experimentAccession");

        //System.out.println(Joiner.on("\", \"").join(accessions));

        assertThat(accessions, hasItem("E-PROT-1"));
    }

}

@@ -387,23 +387,34 @@
 atchers.
-hasItem
+containsInAnyOrder
 ;%0Aimport
@@ -446,20 +446,20 @@
 hers.has
-Size
+Item
 ;%0A%0Apubli
@@ -541,17 +541,9 @@
 oid 
-numberOfE
+e
 xper
@@ -547,17 +547,19 @@
 periment
-s
+Set
 ()%7B%0A    
@@ -857,39 +857,405 @@
 ns, 
-hasSize(NumberOfExperiments.ALL
+containsInAnyOrder(%22E-GEOD-10732%22,%22E-GEOD-11758%22,%22E-GEOD-12108%22,%22E-GEOD-21860%22,%22E-GEOD-22351%22,%22E-GEOD-26284%22,%22E-GEOD-30352%22,%22E-GEOD-3779%22,%22E-GEOD-38400%22,%22E-GEOD-41338%22,%22E-GEOD-43049%22,%22E-GEOD-8122%22,%22E-MEXP-1099%22,%22E-MEXP-1276%22,%22E-MEXP-3628%22,%22E-MTAB-1066%22,%22E-MTAB-1733%22,%22E-MTAB-2039%22,%22E-MTAB-2800%22,%22E-MTAB-2809%22,%22E-MTAB-2812%22,%22E-MTAB-513%22,%22E-MTAB-599%22,%22E-MTAB-698%22,%22E-PROT-1%22,%22E-TABM-51%22,%22E-TABM-713%22
 ));%0A

update test to check for experiment accessions (helps identify the missing ones)