### Question:
PreferencesRecentWorkspacesService implements RecentWorkspacesService { public void flush() { Preferences prefs = Preferences.userRoot().node(WORKSPACES_PATH); LOG.trace("Flushing recently used workspaces"); try { prefs.clear(); for (Entry<String, String> entry : cache.entrySet()) { prefs.put(entry.getValue(), entry.getKey()); } prefs.flush(); } catch (BackingStoreException e) { LOG.error("Error storing recently used workspace", e); } } PreferencesRecentWorkspacesService(); @Override void addWorkspaceLastUsed(File workspace); @Override List<String> getRecentlyUsedWorkspaces(); @Override void clear(); void flush(); @EventListener void onShutdown(ShutdownEvent event);  }### Answer:
@Test public void flush() throws IOException, BackingStoreException { victim.addWorkspaceLastUsed(folder.newFile()); victim.flush(); assertTrue(Preferences.userRoot().node(WORKSPACES_PATH).keys().length > 0); }