@Test
public void updateRawContent_should_preserve_non_content_related_metadata_except_last_modification_date()
        throws Exception {

    // given
    String dataSetId = UUID.randomUUID().toString();
    DataSetMetadata dataSetMetadata = metadataBuilder.metadata().id(dataSetId).build();
    dataSetMetadataRepository.save(dataSetMetadata);
    given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream(TAGADA_CSV), UTF_8))
            .when()
            .put("/datasets/{id}/raw", dataSetId)
            .then()
            .statusCode(OK.value());
    String datasets = when().get("/datasets").asString();
    List<DataSetMetadata> datasetsMetadata =
            mapper.readValue(datasets, new TypeReference<ArrayList<DataSetMetadata>>() {
            });
    final DataSetMetadata original = datasetsMetadata.get(0);
    // when
    given()
            .body(IOUtils.toString(this.getClass().getResourceAsStream(TAGADA2_CSV), UTF_8))
            .when()
            .put("/datasets/{id}/raw", dataSetId)
            .then()
            .statusCode(OK.value());
    // then
    datasets = when().get("/datasets").asString();
    datasetsMetadata = mapper.readValue(datasets, new TypeReference<ArrayList<DataSetMetadata>>() {
    });
    final DataSetMetadata copy = datasetsMetadata.get(0);
    assertThat(copy.getId(), equalTo(original.getId()));
    assertThat(copy.getAppVersion(), equalTo(original.getAppVersion()));
    assertThat(copy.getAuthor(), equalTo(original.getAuthor()));
    assertThat(copy.getCreationDate(), equalTo(original.getCreationDate()));
    assertThat(copy.getLocation(), equalTo(original.getLocation()));
}