@Test
public void existingOutputPolicyRENAME_conflict() throws IOException {

    Map<String, File> files = new HashMap<String, File>();
    files.put("existing.pdf", folder.newFile());
    File outFile = outputFolder.newFile("existing.pdf");
    outputFolder.newFile("existing(1).pdf");
    outputFolder.newFile("existing(2).pdf");
    OutputWriterHelper.moveToFile(files, outFile, ExistingOutputPolicy.RENAME, context);
    assertThat(Arrays.asList(outputFolder.getRoot().list()), hasItem("existing(3).pdf"));
}