public void testAppendTwice() throws IOException {
Directory newDir = newDirectory();
CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random()), true);
createSequenceFile(newDir, "d1", (byte) 0, 15);
IndexOutput out = csw.createOutput("d.xyz", newIOContext(random()));
out.writeInt(0);
try {
newDir.copy(csw, "d1", "d1", newIOContext(random()));
fail("file does already exist");
} catch (IllegalArgumentException e) {