### Question:
DefaultSyncer implements Syncer { @Override public void run() { try { executor = Executors.newFixedThreadPool(10); ensureLocalDir(); index = config.getSyncIndex(); startWatcher(); nav = navigateToRemoteDir(); registerRemoteChangeHandler(nav); registerRemotePoller(); notifyAllContents(nav, remoteChangeHandler); } catch (QblStorageException | IOException e) { logger.error("failed to start sync: " + e.getMessage(), e); } } DefaultSyncer(BoxSyncConfig config, BoxVolume boxVolume, TransferManager manager); void setLocalBlacklist(Blacklist blacklist); @Override List<Transaction> getHistory(); @Override void run(); static void notifyAllContents(BoxNavigation navigation, Observer remoteChangeHandler); boolean isProcessingLocalEvents(); @Override void shutdown(); void join(); @Override void setPollInterval(int amount, TimeUnit unit); @Override void stop(); boolean isPolling(); void waitFor(); BoxSyncBasedUploadFactory getUploadFactory(); void setUploadFactory(BoxSyncBasedUploadFactory uploadFactory); @Override boolean isSynced(); @Override double getProgress(); @Override DefaultSyncer onProgress(Runnable runnable); @Override long totalSize(); @Override long currentSize(); @Override int countFiles(); @Override int countFolders(); @Override boolean hasError(); @Override DefaultSyncer onProgress(Consumer<Transaction> consumer); @Override long totalElements(); @Override long finishedElements(); static final long ASSUMED_DIRECTORY_METADATA_SIZE; }### Answer:
@Test public void addsFilesAsUploads() throws IOException { new File(tmpDir.toFile(), "file").createNewFile(); syncer.run(); waitUntil(() -> manager.getTransactions().size() == 2); }
@Test public void createsLocalDirIfNotExisting() throws Exception { Path newDir = tmpDir.resolve("subdir"); config.setLocalPath(newDir); syncer.run(); waitUntil(() -> Files.isDirectory(newDir)); }
@Test public void bootstrappingCreatesDirIfLocalDirDoesNotExist() throws IOException { FileUtils.deleteDirectory(tmpDir.toFile()); syncer = new DefaultSyncer(config, volume, manager); syncer.run(); assertTrue(Files.isDirectory(tmpDir)); }