@Test(dependsOnMethods = "testGetAllFilePaths") public void testGetFileContent() throws IOException, WorkspaceDocumentException { String expectedContent = readAll(filePath.toFile()); String actualContent = documentManager.getFileContent(filePath); Assert.assertEquals(actualContent, expectedContent); }
@Override public String getFileContent(Path filePath) throws WorkspaceDocumentException { if (isFileOpen(filePath) && documentList.get(filePath) != null) { return documentList.get(filePath).getDocument().map(doc -> doc.getTree().toSourceCode()).orElse(null); } return readFromFileSystem(filePath).toSourceCode(); }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public String getFileContent(Path filePath) throws WorkspaceDocumentException { if (isFileOpen(filePath) && documentList.get(filePath) != null) { return documentList.get(filePath).getDocument().map(doc -> doc.getTree().toSourceCode()).orElse(null); } return readFromFileSystem(filePath).toSourceCode(); } }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public String getFileContent(Path filePath) throws WorkspaceDocumentException { if (isFileOpen(filePath) && documentList.get(filePath) != null) { return documentList.get(filePath).getDocument().map(doc -> doc.getTree().toSourceCode()).orElse(null); } return readFromFileSystem(filePath).toSourceCode(); } protected  WorkspaceDocumentManagerImpl(); }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public String getFileContent(Path filePath) throws WorkspaceDocumentException { if (isFileOpen(filePath) && documentList.get(filePath) != null) { return documentList.get(filePath).getDocument().map(doc -> doc.getTree().toSourceCode()).orElse(null); } return readFromFileSystem(filePath).toSourceCode(); } protected  WorkspaceDocumentManagerImpl(); static WorkspaceDocumentManagerImpl getInstance(); @Override boolean isFileOpen(Path filePath); @Override void openFile(Path filePath, String content); @Override void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent); @Override void setCodeLenses(Path filePath, List<CodeLens> codeLens); @Override void closeFile(Path filePath); @Override List<CodeLens> getCodeLenses(Path filePath); @Override LSDocumentIdentifier getLSDocument(Path filePath); @Override String getFileContent(Path filePath); @Override Optional<Lock> lockFile(Path filePath); @Override Set<Path> getAllFilePaths(); @Override void clearAllFilePaths(); @Override SyntaxTree getTree(Path filePath); @Override void setTree(Path filePath, SyntaxTree newTree); }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public String getFileContent(Path filePath) throws WorkspaceDocumentException { if (isFileOpen(filePath) && documentList.get(filePath) != null) { return documentList.get(filePath).getDocument().map(doc -> doc.getTree().toSourceCode()).orElse(null); } return readFromFileSystem(filePath).toSourceCode(); } protected  WorkspaceDocumentManagerImpl(); static WorkspaceDocumentManagerImpl getInstance(); @Override boolean isFileOpen(Path filePath); @Override void openFile(Path filePath, String content); @Override void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent); @Override void setCodeLenses(Path filePath, List<CodeLens> codeLens); @Override void closeFile(Path filePath); @Override List<CodeLens> getCodeLenses(Path filePath); @Override LSDocumentIdentifier getLSDocument(Path filePath); @Override String getFileContent(Path filePath); @Override Optional<Lock> lockFile(Path filePath); @Override Set<Path> getAllFilePaths(); @Override void clearAllFilePaths(); @Override SyntaxTree getTree(Path filePath); @Override void setTree(Path filePath, SyntaxTree newTree);  }