@Test
public void test_add_preparation_TDP3927() throws Exception {

    // given
    final String preparationId = testClient.createPreparationFromFile(
            "/org/talend/dataprep/api/service/dataset/bug_TDP-3927_import-col-not-deleted_truncated.csv",
            "bug_TDP-3927_import-col-not-deleted", home.getId());
    Map<String, String> copyIdParameters = new HashMap<>();
    copyIdParameters.put("column_id", "0000");
    copyIdParameters.put("column_name", "id");
    copyIdParameters.put("scope", "column");
    testClient.applyAction(preparationId, "copy", copyIdParameters);
    InputStream inputStream = testClient.getPreparation(preparationId).asInputStream();
    mapper.getDeserializationConfig().without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    RowMetadata preparationContent = mapper.readValue(inputStream, Data.class).metadata;
    ColumnMetadata idCopyColumn = getColumnByName(preparationContent, "id_copy");
    Map<String, String> deleteIdCopyParameters = new HashMap<>();
    deleteIdCopyParameters.put("column_id", "0008");
    deleteIdCopyParameters.put("column_name", "id_copy");
    deleteIdCopyParameters.put("scope", "column");
    testClient.applyAction(preparationId, "delete_column", deleteIdCopyParameters);
    // force export to update cache
    testClient.getPreparation(preparationId);
    // when
    Map<String, String> copyFirstNameParameters = new HashMap<>();
    copyFirstNameParameters.put("column_id", "0001");
    copyFirstNameParameters.put("column_name", "first_name");
    copyFirstNameParameters.put("scope", "column");
    testClient.applyAction(preparationId, "copy", copyFirstNameParameters);
    // then
    inputStream = testClient.getPreparation(preparationId).asInputStream();
    mapper.getDeserializationConfig().without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    preparationContent = mapper.readValue(inputStream, Data.class).metadata;
    assertNotNull(preparationContent);
    ColumnMetadata firstNameColumn = getColumnByName(preparationContent, "first_name_copy");
    assertNotEquals(idCopyColumn.getId(), firstNameColumn.getId());
}