@Test
public void update() throws Exception {

    assertThat(repository.list(Preparation.class).count(), is(0L));
    final String preparationId = clientTest.createPreparation(createTestPreparation("test_name", "1234")).getId();
    final Preparation createdPreparation = repository.list(Preparation.class).iterator().next();
    assertThat(createdPreparation.getId(), is(preparationId));
    final long oldModificationDate = createdPreparation.getLastModificationDate();
    // Test preparation details update
    PreparationDTO forUpdate = new PreparationDTO();
    forUpdate.setName("test_name_updated");
    forUpdate.setDataSetId("1234");
    final String updatedId = given()
            .contentType(ContentType.JSON) //
            .body(forUpdate) //
            .when() //
            .put("/preparations/{id}", preparationId) //
            .asString();
    // Preparation id should not change (name is not part of preparation id).
    assertThat(updatedId, is(preparationId));
    final Collection<Preparation> preparations = repository.list(Preparation.class).collect(Collectors.toList());
    assertThat(preparations.size(), is(1));
    final Preparation preparation = preparations.iterator().next();
    assertThat(preparation.getName(), is("test_name_updated"));
    assertThat(preparation.getLastModificationDate(), is(greaterThan(oldModificationDate)));
    assertThat(preparation.getAppVersion(), is(versionService.version().getVersionId()));
}