### Question:
FileMonitorConfiguration implements SmartLifecycle, ResourceLoaderAware { @Override public synchronized void start() { if (!this.running) { this.directory = getFileRepo(); if (this.directory != null && !this.directory.isEmpty()) { log.info("Monitoring for local config changes: " + this.directory); try { this.watcher = FileSystems.getDefault().newWatchService(); for (Path path : this.directory) { walkDirectory(path); } } catch (IOException e) { } } else { log.info("Not monitoring for local config changes"); } this.running = true; } }  @Override void setResourceLoader(ResourceLoader resourceLoader); @Override int getPhase(); void setPhase(int phase); @Override boolean isRunning(); void setRunning(boolean running); @Override boolean isAutoStartup(); void setAutoStartup(boolean autoStartup); @Override synchronized void start(); @Override synchronized void stop(); @Override void stop(Runnable callback); @Scheduled(fixedRateString = "${spring.cloud.config.server.monitor.fixedDelay:5000}") void poll();  }### Answer:
@Test public void testStart_whenRepositoriesAreNull() { fileMonitorConfiguration.start(); Set<Path> directory = getDirectory(); assertThat(directory).isNull(); }
@Test public void testStart_withNativeEnvironmentRepository() { NativeEnvironmentRepository repository = createNativeEnvironmentRepository(); ReflectionTestUtils.setField(fileMonitorConfiguration, "nativeEnvironmentRepository", repository); fileMonitorConfiguration.start(); assertOnDirectory(1); }
@Test public void testStart_withOneScmRepository() { AbstractScmEnvironmentRepository repository = createScmEnvironmentRepository(SAMPLE_PATH); addScmRepository(repository); fileMonitorConfiguration.start(); assertOnDirectory(1); }
@Test public void testStart_withTwoScmRepositories() { AbstractScmEnvironmentRepository repository = createScmEnvironmentRepository(SAMPLE_PATH); AbstractScmEnvironmentRepository secondRepository = createScmEnvironmentRepository("anotherPath"); addScmRepository(repository); addScmRepository(secondRepository); fileMonitorConfiguration.start(); assertOnDirectory(2); }
@Test public void testStart_withOneFileUrlScmRepository() { AbstractScmEnvironmentRepository repository = createScmEnvironmentRepository(SAMPLE_FILE_URL); addScmRepository(repository); fileMonitorConfiguration.start(); assertOnDirectory(1); }
@Test public void testStart_withTwoMixedPathAndFileUrlScmRepositories() { AbstractScmEnvironmentRepository repository = createScmEnvironmentRepository(SAMPLE_PATH); AbstractScmEnvironmentRepository secondRepository = createScmEnvironmentRepository(SAMPLE_FILE_URL); addScmRepository(repository); addScmRepository(secondRepository); fileMonitorConfiguration.start(); assertOnDirectory(2); }