+ "</body></html>"; // Text = 'Dies ist der Test Text'
String text = "Test HTML Seite fuer JUnit Test Dies ist der Test\u00A0Text";
// Create a test HTML File
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(rootPath , null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(filePath, rootFolder);
VFSLeaf leaf = (VFSLeaf)namedFolder.resolve(htmlFileName);
if (leaf != null) {
leaf.delete();
}
leaf = namedFolder.createChildLeaf(htmlFileName);
BufferedOutputStream bos = new BufferedOutputStream(leaf.getOutputStream(false));
FileUtils.save(bos,htmlText,"utf-8");
try {
bos.close();
SearchResourceContext resourceContext = new SearchResourceContext();
resourceContext.setBusinessControlFor(OresHelper.createOLATResourceableType("FileDocumentFactoryTest"));
resourceContext.setFilePath(filePath + "/" + leaf.getName());
Document htmlDocument = FileDocumentFactory.createDocument(resourceContext, leaf);
// 1. Check content
String content = htmlDocument.get(OlatDocument.CONTENT_FIELD_NAME);
assertEquals("Wrong HTML content=" + content.trim() + " , must be =" + text.trim(), text.trim(), content.trim());
// 2. Check resourceUrl