SyncTool { protected boolean restartPossible() { boolean restart = false; if (!syncConfig.isCleanStart()) { SyncToolConfigParser syncConfigParser = new SyncToolConfigParser(); SyncToolConfig prevConfig = syncConfigParser.retrievePrevConfig(syncConfig.getWorkDir()); if (prevConfig != null) { restart = configEquals(syncConfig, prevConfig); } } return restart; } SyncTool(); void runSyncTool(); String getPrintableHelp();  }
@Test public void testRestartPossible() throws Exception { SyncToolConfig config = new SyncToolConfig(); config.setCleanStart(true); syncTool.setSyncConfig(config); assertFalse(syncTool.restartPossible()); File workDir = createTempDir("testwork"); config.setCleanStart(false); config.setWorkDir(workDir); assertFalse(syncTool.restartPossible()); File contentDir = createTempDir("testcontent"); String[] args = {"-h", prevHost, "-s", prevSpaceId, "-i", prevStoreId, "-c", contentDir.getPath(), "-u", "user", "-p", "pass", "-w", workDir.getAbsolutePath()}; ConfigStorage storage = new ConfigStorage(); storage.backupConfig(workDir, args); storage.backupConfig(workDir, args); List<File> contentDirs = new ArrayList<>(); contentDirs.add(contentDir); config = getConfig(prevHost, prevSpaceId, prevStoreId, prevSyncDel, prevNoUpdates, prevRenameUpdates, prevPrefix, prevExclude, contentDirs); config.setWorkDir(workDir); syncTool.setSyncConfig(config); assertTrue(syncTool.restartPossible()); FileUtils.deleteQuietly(workDir); FileUtils.deleteQuietly(contentDir); }