SyncToolConfigParser { protected SyncToolConfig processStandardOptions(String[] args) throws ParseException { return processStandardOptions(args, true); } SyncToolConfigParser(); SyncToolConfig processCommandLine(String[] args); SyncToolConfig retrievePrevConfig(File backupDir);  }
@Test public void testStandardOptions() throws Exception { HashMap<String, String> argsMap = getArgsMap(); SyncToolConfig syncConfig = syncConfigParser.processStandardOptions(mapToArray(argsMap)); checkStandardOptions(argsMap, syncConfig); argsMap.remove("-f"); argsMap.remove("-r"); argsMap.remove("-i"); argsMap.remove("-t"); argsMap.remove("-m"); argsMap.remove("-d"); argsMap.remove("-l"); argsMap.remove("-x"); argsMap.remove("-w"); argsMap.remove("-a"); argsMap.remove("-e"); argsMap.remove("-n"); argsMap.remove("-o"); argsMap.remove("-j"); syncConfig = syncConfigParser.processStandardOptions(mapToArray(argsMap)); assertEquals(SyncToolConfigParser.DEFAULT_POLL_FREQUENCY, syncConfig.getPollFrequency()); assertEquals(SyncToolConfigParser.DEFAULT_PORT, syncConfig.getPort()); assertNull(syncConfig.getStoreId()); assertEquals(SyncToolConfigParser.DEFAULT_NUM_THREADS, syncConfig.getNumThreads()); assertEquals(SyncToolConfigParser.DEFAULT_MAX_FILE_SIZE * SyncToolConfigParser.GIGABYTE, syncConfig.getMaxFileSize()); assertEquals(false, syncConfig.syncDeletes()); assertEquals(false, syncConfig.isCleanStart()); assertEquals(false, syncConfig.exitOnCompletion()); assertEquals(expectedPassword, syncConfig.getPassword()); assertNull(syncConfig.getWorkDir()); assertNull(syncConfig.getPrefix()); assertNull(syncConfig.getExcludeList()); assertFalse(syncConfig.isRenameUpdates()); assertTrue(syncConfig.isSyncUpdates()); assertFalse(syncConfig.isJumpStart()); for (String arg : argsMap.keySet()) { String failMsg = "An exception should have been thrown due to " + "missing arg: " + arg; removeArgFailTest(argsMap, arg, failMsg); } String failMsg = "Frequency arg should require a numerical value"; addArgFailTest(argsMap, "-f", "nonNum", failMsg); failMsg = "Port arg should require a numerical value"; addArgFailTest(argsMap, "-r", "nonNum", failMsg); failMsg = "Threads arg should require a numerical value"; addArgFailTest(argsMap, "-t", "nonNum", failMsg); failMsg = "Max file size arg should require a numerical value"; addArgFailTest(argsMap, "-m", "nonNum", failMsg); failMsg = "Max file size arg should be between 1 and 5"; addArgFailTest(argsMap, "-m", "0", failMsg); addArgFailTest(argsMap, "-m", "6", failMsg); }