final HttpServletRequest req=ServletTestRunner.localRequest.get();
Host hh=new Host(req.getServerName(),"/webdav/autopub",req.getServerPort(),"admin@dotcms.com","admin",null,null);
Folder demo=(Folder)hh.child("demo.dotcms.com");
Folder wt=(Folder)((Folder)demo.child("wt")).child(ff.getName());
File wtFile=(File)wt.child("legacy.txt");
final String newContent="new File content";
wtFile.setContent(new ByteArrayInputStream(newContent.getBytes()), (long)newContent.getBytes().length);
file = APILocator.getFileAPI().getWorkingFileById(file.getIdentifier(), user, false);