@Test
public void should_get_content_from_updated_dataset() throws Exception {

    // given
    final String dataSetId = given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream(TAGADA_CSV), UTF_8))
            .queryParam("Content-Type", "text/csv")
            .when()
            .post("/datasets")
            .asString();
    assertQueueMessages(dataSetId);
    // given: update content
    given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream("../tagada3.csv"), UTF_8))
            .queryParam("Content-Type", "text/csv")
            .when()
            .put("/datasets/" + dataSetId + "/raw");
    assertQueueMessages(dataSetId);
    // when
    final InputStream content = when().get("/datasets/{id}/content?metadata=false", dataSetId).asInputStream();
    final String contentAsString = IOUtils.toString(content, UTF_8);
    // then
    final InputStream expected = this.getClass().getResourceAsStream("../content/test2.json");
    assertThat(contentAsString, sameJSONAsFile(expected));
    // Update name
    String expectedName = "testOfADataSetName";
    given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream("../tagada3.csv"), UTF_8))
            .queryParam("Content-Type", "text/csv")
            .when()
            .put("/datasets/" + dataSetId + "/raw?name=" + expectedName);
    final DataSetMetadata dataSetMetadata = dataSetMetadataRepository.get(dataSetId);
    assertThat(dataSetMetadata, notNullValue());
    assertThat(dataSetMetadata.getName(), is(expectedName));
}