Search in sources :

Example 86 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project data-prep by Talend.

the class PreparationAPITest method testPreparationsList_withFilterOnFullPath.

@Test
public void testPreparationsList_withFilterOnFullPath() throws Exception {
    // given
    String tagadaId = testClient.createDataset("dataset/dataset.csv", "tagada");
    String preparationName = "tagadaPreparation";
    String preparationId = testClient.createPreparationFromDataset(tagadaId, preparationName, home.getId());
    // when : short format
    final JsonPath shouldNotBeEmpty = when().get("/api/preparations/?format=short&path={path}", "/" + preparationName).jsonPath();
    // then
    assertThat(shouldNotBeEmpty.<String>getList("id").get(0), is(preparationId));
    // when
    final JsonPath shouldBeEmpty = when().get("/api/preparations/?format=short&path={path}", "/toto/" + preparationName).jsonPath();
    // then
    assertThat(shouldBeEmpty.<String>getList("id"), is(empty()));
}
Also used : JsonPath(com.jayway.restassured.path.json.JsonPath) Test(org.junit.Test)

Example 87 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project data-prep by Talend.

the class DatasetStep method thenICheckTheDataSetRecordsNumber.

@Then("^I check that the dataSet \"(.*)\" has \"(.*)\" records$")
public void thenICheckTheDataSetRecordsNumber(String datasetName, String recordNumber) throws IOException {
    Response response = api.getDataSetMetaData(context.getDatasetId(suffixName(datasetName)));
    response.then().statusCode(OK.value());
    final JsonPath jsonPath = response.body().jsonPath();
    assertEquals(recordNumber, jsonPath.get("records").toString());
}
Also used : Response(com.jayway.restassured.response.Response) JsonPath(com.jayway.restassured.path.json.JsonPath) Then(cucumber.api.java.en.Then)

Aggregations

JsonPath (com.jayway.restassured.path.json.JsonPath)87 Test (org.junit.Test)56 Response (com.jayway.restassured.response.Response)29 BaseRestTest (integration.BaseRestTest)11 BaseRestIntegrationTest (se.inera.intyg.webcert.web.web.controller.integrationtest.BaseRestIntegrationTest)10 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)9 Matchers.anyString (org.mockito.Matchers.anyString)8 ValidatableResponse (com.jayway.restassured.response.ValidatableResponse)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 Matchers.containsString (org.hamcrest.Matchers.containsString)6 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 Ignore (org.junit.Ignore)5 MongoDbSeed (integration.MongoDbSeed)4 HashMap (java.util.HashMap)3 Then (cucumber.api.java.en.Then)2 AbstractIntegrationTest (org.codice.ddf.itests.common.AbstractIntegrationTest)2 BaseMatcher (org.hamcrest.BaseMatcher)2 Description (org.hamcrest.Description)2 PreparationDTO (org.talend.dataprep.api.preparation.PreparationDTO)2