@Test public void saveWithoutOpenedPresentationDate() throws Exception { final String path = "presentation.sfx"; final RecentPresentation recentPresentation = new RecentPresentation(path, null); final ByteArrayInputStream input = new ByteArrayInputStream(new byte[0]); final ByteArrayOutputStream output = new ByteArrayOutputStream(); ContextFileWorker.saveRecentPresentation(input, output, recentPresentation); assertEquals(0, output.size()); }
protected static void saveRecentPresentation(final InputStream input, final OutputStream output, final RecentPresentation recentPresentation) throws ContextFileException { final Document document = createDocumentFromInput(input); populateDocumentIfNecessary(document); final Node recentPresentationsNode = getRecentPresentationsNode(document); final Node recentPresentationNode = createNodeFromRecentPresentation(document, recentPresentation); if (recentPresentationNode != null) { recentPresentationsNode.appendChild(recentPresentationNode); writeDocument(document, output); } }
ContextFileWorker { protected static void saveRecentPresentation(final InputStream input, final OutputStream output, final RecentPresentation recentPresentation) throws ContextFileException { final Document document = createDocumentFromInput(input); populateDocumentIfNecessary(document); final Node recentPresentationsNode = getRecentPresentationsNode(document); final Node recentPresentationNode = createNodeFromRecentPresentation(document, recentPresentation); if (recentPresentationNode != null) { recentPresentationsNode.appendChild(recentPresentationNode); writeDocument(document, output); } } }
ContextFileWorker { protected static void saveRecentPresentation(final InputStream input, final OutputStream output, final RecentPresentation recentPresentation) throws ContextFileException { final Document document = createDocumentFromInput(input); populateDocumentIfNecessary(document); final Node recentPresentationsNode = getRecentPresentationsNode(document); final Node recentPresentationNode = createNodeFromRecentPresentation(document, recentPresentation); if (recentPresentationNode != null) { recentPresentationsNode.appendChild(recentPresentationNode); writeDocument(document, output); } } private  ContextFileWorker(); }
ContextFileWorker { protected static void saveRecentPresentation(final InputStream input, final OutputStream output, final RecentPresentation recentPresentation) throws ContextFileException { final Document document = createDocumentFromInput(input); populateDocumentIfNecessary(document); final Node recentPresentationsNode = getRecentPresentationsNode(document); final Node recentPresentationNode = createNodeFromRecentPresentation(document, recentPresentation); if (recentPresentationNode != null) { recentPresentationsNode.appendChild(recentPresentationNode); writeDocument(document, output); } } private  ContextFileWorker(); static Set<RecentPresentation> readRecentPresentationFromFile(final File contextFile); static void saveRecentPresentationToFile(final File contextFile, final RecentPresentation recentPresentation); static void updateRecentPresentationInFile(final File contextFile, final RecentPresentation recentPresentation); static boolean recentPresentationAlreadyPresent(final File contextFile, final RecentPresentation recentPresentation); static Set<RecentPresentation> purgeRecentPresentations(final InputStream input, final OutputStream output, final long numberOfRecentPresentationsToKeep); }
ContextFileWorker { protected static void saveRecentPresentation(final InputStream input, final OutputStream output, final RecentPresentation recentPresentation) throws ContextFileException { final Document document = createDocumentFromInput(input); populateDocumentIfNecessary(document); final Node recentPresentationsNode = getRecentPresentationsNode(document); final Node recentPresentationNode = createNodeFromRecentPresentation(document, recentPresentation); if (recentPresentationNode != null) { recentPresentationsNode.appendChild(recentPresentationNode); writeDocument(document, output); } } private  ContextFileWorker(); static Set<RecentPresentation> readRecentPresentationFromFile(final File contextFile); static void saveRecentPresentationToFile(final File contextFile, final RecentPresentation recentPresentation); static void updateRecentPresentationInFile(final File contextFile, final RecentPresentation recentPresentation); static boolean recentPresentationAlreadyPresent(final File contextFile, final RecentPresentation recentPresentation); static Set<RecentPresentation> purgeRecentPresentations(final InputStream input, final OutputStream output, final long numberOfRecentPresentationsToKeep);  }