// Path: src/main/java/mirror/tasks/StubTaskFactory.java
// public class StubTaskFactory implements TaskFactory {
// 
//   private final Map<TaskLogic, StubTask> tasks = new ConcurrentHashMap<>();
// 
//   @Override
//   public TaskHandle runTask(TaskLogic logic, Runnable onFailure) {
//     StubTask task = new StubTask(logic, onFailure);
//     tasks.put(logic, task);
//     return () -> stopTask(logic);
//   }
// 
//   @Override
//   public void stopTask(TaskLogic logic) {
//     StubTask task = tasks.get(logic);
//     if (task != null) {
//       tasks.remove(logic);
//       Utils.resetIfInterrupted(() -> task.stop());
//     }
//   }
// 
//   public void tick() {
//     tasks.values().forEach(t -> Utils.resetIfInterrupted(() -> t.tick()));
//   }
// 
//   public Duration getLastDuration(TaskLogic logic) {
//     return tasks.get(logic).lastDuration;
//   }
// }


import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import mirror.tasks.StubTaskFactory;
package mirror;





public class MirrorServerTest {

  private final List<Update> fileUpdates = new ArrayList<>();
  private final FileWatcherFactory fileWatcherFactory = Mockito.mock(FileWatcherFactory.class);
  private final FileWatcher fileWatcher = Mockito.mock(FileWatcher.class);
  private final StubFileAccess rootFileAccess = new StubFileAccess();
  private final StubFileAccess sessionFileAccess = new StubFileAccess();
  private final FileAccessFactory accessFactory = (path) -> sessionFileAccess;
// Path: src/main/java/mirror/tasks/StubTaskFactory.java
// public class StubTaskFactory implements TaskFactory {
// 
//   private final Map<TaskLogic, StubTask> tasks = new ConcurrentHashMap<>();
// 
//   @Override
//   public TaskHandle runTask(TaskLogic logic, Runnable onFailure) {
//     StubTask task = new StubTask(logic, onFailure);
//     tasks.put(logic, task);
//     return () -> stopTask(logic);
//   }
// 
//   @Override
//   public void stopTask(TaskLogic logic) {
//     StubTask task = tasks.get(logic);
//     if (task != null) {
//       tasks.remove(logic);
//       Utils.resetIfInterrupted(() -> task.stop());
//     }
//   }
// 
//   public void tick() {
//     tasks.values().forEach(t -> Utils.resetIfInterrupted(() -> t.tick()));
//   }
// 
//   public Duration getLastDuration(TaskLogic logic) {
//     return tasks.get(logic).lastDuration;
//   }
// }


// Path: src/test/java/mirror/MirrorServerTest.java
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import mirror.tasks.StubTaskFactory;

package mirror;





public class MirrorServerTest {

  private final List<Update> fileUpdates = new ArrayList<>();
  private final FileWatcherFactory fileWatcherFactory = Mockito.mock(FileWatcherFactory.class);
  private final FileWatcher fileWatcher = Mockito.mock(FileWatcher.class);
  private final StubFileAccess rootFileAccess = new StubFileAccess();
  private final StubFileAccess sessionFileAccess = new StubFileAccess();
  private final FileAccessFactory accessFactory = (path) -> sessionFileAccess;
  private final StubTaskFactory taskFactory = new StubTaskFactory();