runUpThread.join();
deleteFilesThread.join();
// Test 1: There should be between 50 and 100 file histories in the database
SqlDatabase databaseClientA = clientA.loadLocalDatabase();
assertTrue("There should be less file histories than originally added files.", databaseClientA.getFileHistoriesWithFileVersions().size() < numFiles);
assertTrue("There should be more (or equal size) file histories than files there are.", databaseClientA.getFileHistoriesWithFileVersions().size() >= numFilesRemaining);
// Test 2: Now up the rest, there should be exactly 50 files in the database
clientA.up();
clientA.cleanup();
databaseClientA = clientA.loadLocalDatabase();
assertEquals("There should be EXACTLY "+numFilesRemaining+" file histories in the database.", numFilesRemaining, databaseClientA.getFileHistoriesWithFileVersions().size());
// Test 3: After that, the sync between the clients should of course still work
clientB.down();
assertFileListEquals("Files of both clients should be identical.", clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());