@Test
public void nbLinesUpdate() throws Exception {

    String dataSetId = given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream(TAGADA_CSV), UTF_8))
            .queryParam(CONTENT_TYPE, "text/csv")
            .when()
            .post("/datasets")
            .asString();
    assertQueueMessages(dataSetId);
    InputStream content = when().get("/datasets/{id}/content?metadata=true", dataSetId).asInputStream();
    String contentAsString = IOUtils.toString(content, UTF_8);
    assertThat(contentAsString, sameJSONAs("{\"metadata\":{\"records\":2,\"nbLinesHeader\":1,\"nbLinesFooter\":0}}")
            .allowingExtraUnexpectedFields()
            .allowingAnyArrayOrdering());
    given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream(T_SHIRT_100_CSV), UTF_8))
            .queryParam(CONTENT_TYPE, "text/csv")
            .when()
            .put("/datasets/{id}/raw", dataSetId)
            .asString();
    assertQueueMessages(dataSetId);
    content = when().get("/datasets/{id}/content?metadata=true", dataSetId).asInputStream();
    contentAsString = IOUtils.toString(content, UTF_8);
    InputStream expected = this.getClass().getResourceAsStream(T_SHIRT_100_CSV_EXPECTED_JSON);
    assertThat(contentAsString, sameJSONAsFile(expected));
}