@Test
public void shouldMoveAStepToNonBoundaryPositionIfLegal() throws Exception {

    // given
    final String preparationId = createPreparation("1234", "My preparation");
    final String upperCaseStepId = applyTransformation(preparationId, "actions/append_upper_case.json");
    final String copyStepId = applyTransformation(preparationId, "actions/append_copy_lastname.json");
    applyTransformation(preparationId, "actions/append_rename_copy_lastname.json");
    final String headStepId = applyTransformation(preparationId, "actions/append_lower_case.json");
    Step head = repository.get(headStepId, Step.class);
    PreparationActions headActions = repository.get(head.getContent(), PreparationActions.class);
    assertThat(headActions.getActions(), hasSize(4));
    assertThat(headActions.getActions().get(0).getName(), is("uppercase"));
    assertThat(headActions.getActions().get(1).getName(), is("copy"));
    assertThat(headActions.getActions().get(2).getName(), is("rename_column"));
    assertThat(headActions.getActions().get(3).getName(), is("lowercase"));
    // when : delete second step in single mode
    // @formatter:off
    given()
        .queryParam("parentStepId", copyStepId)
    .when()
        .post("/preparations/{id}/steps/{stepId}/order", preparationId, upperCaseStepId)//
    .then()//
        .statusCode(200);
    // @formatter:on
    // then
    final Preparation preparation = repository.get(preparationId, Preparation.class);
    final String newHeadStepId = preparation.getHeadId();
    head = repository.get(newHeadStepId, Step.class);
    headActions = repository.get(head.getContent(), PreparationActions.class);
    assertThat(headActions.getActions(), hasSize(4));
    assertThat(headActions.getActions().get(0).getName(), is("copy"));
    assertThat(headActions.getActions().get(1).getName(), is("uppercase"));
    assertThat(headActions.getActions().get(2).getName(), is("rename_column"));
    assertThat(headActions.getActions().get(3).getName(), is("lowercase"));
}