@Test
public void updateAction_shouldSaveUpdatedStepDiffAndShiftColumnsIds() throws Exception {

    // given
    final String preparationId = createPreparation("1234", "my preparation");
    AppendStep firstStep = step(null, action("copy", paramsColAction("0003", "birth")));
    clientTest.addStep(preparationId, firstStep);
    AppendStep secondStep = step(null, action("split",
            params("column_id", "0001", "column_name", "firstname", "scope", "column", "limit", "2")));
    clientTest.addStep(preparationId, secondStep);
    final Preparation preparation = repository.get(preparationId, Preparation.class);
    final List<String> stepIds = preparationUtils.listStepsIds(preparation.getHeadId(), repository);
    assertEquals(3, stepIds.size());
    assertEquals(singletonList("0004"), repository.get(stepIds.get(1), Step.class).getDiff().getCreatedColumns());
    assertEquals(asList("0005", "0006"), repository.get(stepIds.get(2), Step.class).getDiff().getCreatedColumns());
    // when : +1 column
    given()
            .body(step(diff("0004", "0005", "0006"), action("split", paramsColAction("0001", "firstname")))) //
            .contentType(ContentType.JSON) //
            .when() //
            .put("/preparations/{id}/actions/{action}", preparationId, stepIds.get(1));
    // then
    final String newHeadId = repository.get(preparationId, Preparation.class).getHeadId();
    final List<String> stepIdsAfter = preparationUtils.listStepsIds(newHeadId, repository);
    assertThatStepHasCreatedColumns(stepIdsAfter.get(1), "0004", "0005", "0006");
    assertThatStepHasCreatedColumns(stepIdsAfter.get(2), "0007", "0008");
}