SyncTool { protected boolean configEquals(SyncToolConfig currConfig, SyncToolConfig prevConfig) { boolean sameHost = currConfig.getHost().equals(prevConfig.getHost()); boolean sameSpaceId = currConfig.getSpaceId().equals(prevConfig.getSpaceId()); boolean sameStoreId = sameConfig(currConfig.getStoreId(), prevConfig.getStoreId()); boolean sameSyncDeletes = currConfig.syncDeletes() == prevConfig.syncDeletes(); boolean sameContentDirs = currConfig.getContentDirs().equals(prevConfig.getContentDirs()); boolean sameSyncUpdates = currConfig.isSyncUpdates() == prevConfig.isSyncUpdates(); boolean sameRenameUpdates = currConfig.isRenameUpdates() == prevConfig.isRenameUpdates(); boolean sameExclude = sameConfig(currConfig.getExcludeList(), prevConfig.getExcludeList()); boolean samePrefix = sameConfig(currConfig.getPrefix(), prevConfig.getPrefix()); if (sameHost && sameSpaceId && sameStoreId && sameSyncDeletes && sameContentDirs && sameSyncUpdates && sameRenameUpdates && sameExclude && samePrefix) { return true; } return false; } SyncTool(); void runSyncTool(); String getPrintableHelp();  }
@Test public void testConfigEquals() { SyncToolConfig prevConfig = getPrevConfig(); assertTrue(syncTool.configEquals(prevConfig, prevConfig)); SyncToolConfig currConfig = getPrevConfig(); assertTrue(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setHost("host"); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setSpaceId("spaceId"); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setStoreId("storeId"); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setStoreId(null); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setSyncDeletes(true); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setSyncUpdates(false); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setRenameUpdates(true); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setPrefix("prefix"); assertFalse(syncTool.configEquals(currConfig, prevConfig)); currConfig = getPrevConfig(); currConfig.setExcludeList(new File(fileName1)); assertFalse(syncTool.configEquals(currConfig, prevConfig)); List<File> newDirs = new ArrayList<>(); newDirs.add(new File(fileName1)); currConfig = getPrevConfig(); currConfig.setContentDirs(newDirs); assertFalse(syncTool.configEquals(currConfig, prevConfig)); newDirs = new ArrayList<>(); newDirs.add(new File(fileName2)); currConfig = getPrevConfig(); currConfig.setContentDirs(newDirs); assertFalse(syncTool.configEquals(currConfig, prevConfig)); newDirs = new ArrayList<>(); newDirs.add(new File("newFile.txt")); currConfig = getPrevConfig(); currConfig.setContentDirs(newDirs); assertFalse(syncTool.configEquals(currConfig, prevConfig)); }