File workingDir = tmpFolder.newFolder("fakeWorkingDir");
File fakeRepo = new File(workingDir, ".geogig");
fakeRepo.mkdirs();
Platform platform = mock(Platform.class);
when(platform.pwd()).thenReturn(workingDir);
URL resolvedRepoDir = new ResolveGeogigDir(platform).call().get();
assertEquals(fakeRepo.toURI().toURL(), resolvedRepoDir);
workingDir = new File(new File(workingDir, "subdir1"), "subdir2");
workingDir.mkdirs();
when(platform.pwd()).thenReturn(workingDir);
resolvedRepoDir = new ResolveGeogigDir(platform).call().get();
assertEquals(fakeRepo.toURI().toURL(), resolvedRepoDir);
when(platform.pwd()).thenReturn(tmpFolder.getRoot());
assertFalse(new ResolveGeogigDir(platform).call().isPresent());
}