@Test
public void testCopyWithBackup() throws Exception {

	String filename = "backupTest" + FILE1;
	String contents = "text content:";
	String srcFolder = "srcFolder";
	String dstFolder = "dstFolder";
	int numOfBackups=3;
	int numOfFilesPresentAtStart=5;
	
	if (_fileExists(filename)) {
		_deleteFile(dstFolder, filename);
	}
	if (dstFolder!=null) {
		if  (_folderExists(dstFolder)) {
			_createFolder(dstFolder);
		}
	}
	for (int i=1;i<=numOfFilesPresentAtStart;i++) {
		createFile(dstFolder, filename+"."+i,contents+i);
	}
	createFile(dstFolder, filename,contents+"0");
	createFile(srcFolder, filename,contents+"new");
	
	F file = fileSystem.toFile(srcFolder, filename);
	
	assertFileExistsWithContents(dstFolder, filename, contents.trim()+"0");
	assertFileExistsWithContents(dstFolder, filename+"."+numOfFilesPresentAtStart, contents.trim()+(numOfFilesPresentAtStart));
	
	// execute move
	FileSystemUtils.copyFile(fileSystem, file, dstFolder, false, numOfBackups, false);
	
	// assert that the file has been backed up, and backups have been rotated
	assertFileExistsWithContents(srcFolder, filename, contents.trim()+"new");
	assertFileExistsWithContents(dstFolder, filename, contents.trim()+"new");
	for (int i=1;i<=numOfBackups;i++) {
		assertFileExistsWithContents(dstFolder, filename+"."+i, contents.trim()+(i-1));
	}
	assertFileDoesNotExist(dstFolder, filename+(numOfBackups+1));
	assertFileDoesNotExist(dstFolder, filename+(numOfBackups+2));
}