@Test
public void shouldCopy() throws Exception {

    // given
    final Folder fromFolder = folderRepository.addFolder(home.getId(), "from");
    final Folder toFolder = folderRepository.addFolder(home.getId(), "to");
    final String originalId =
            clientTest.createPreparation(createTestPreparation("test_name", "1234"), fromFolder.getId()).getId();
    // Change the author, to make it different from system user.
    repository.get(originalId, Preparation.class).setAuthor("tagada");
    // when
    final Response response = given() //
            .queryParam("name", "the new preparation") //
            .queryParam("destination", toFolder.getId()) //
            .when() //
            .expect()
            .statusCode(200)
            .log()
            .ifError() //
            .post("/preparations/{id}/copy", originalId);
    final String copyId = response.asString();
    // then
    assertThat(response.getStatusCode(), is(200));
    assertThatPreparationIsFirstInsideFolder(copyId, toFolder.getId());
    assertEquals("the new preparation", repository.get(copyId, Preparation.class).getName());
    // Assert that the author is the system user, and not the original author of the prep:
    assertEquals(System.getProperty("user.name"), repository.get(copyId, Preparation.class).getAuthor());
    // row metadata its nullity after copy caused https://jira.talendforge.org/browse/TDP-3379
    assertNotNull(repository.get(copyId, Preparation.class).getRowMetadata());
}