JGitFileSystemsManager { public void updateFSCacheEntry(String fsKey, JGitFileSystem jGitFileSystem) { if (getFsCache().containsKey(fsKey)) { fsCache.replaceSupplier(fsKey, () -> jGitFileSystem); } } JGitFileSystemsManager(final JGitFileSystemProvider jGitFileSystemProvider,
                                  final JGitFileSystemProviderConfiguration config); void newFileSystem(Supplier<Map<String, String>> fullHostNames,
                              Supplier<Git> git,
                              Supplier<String> fsName,
                              Supplier<CredentialsProvider> credential,
                              Supplier<JGitFileSystemsEventsManager> fsManager,
                              Supplier<Map<FileSystemHooks, ?>> fsHooks); void updateFSCacheEntry(String fsKey, JGitFileSystem jGitFileSystem); void remove(String realFSKey); JGitFileSystem get(String fsName); void clear(); boolean containsKey(String fsName); boolean containsRoot(String fsName); void addClosedFileSystems(JGitFileSystem fileSystem); boolean allTheFSAreClosed(); JGitFileSystem get(Repository db); Set<JGitFileSystem> getOpenFileSystems(); JGitFileSystemsCache getFsCache();  }
@Test public void updateFSCacheEntryTest() { final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class); JGitFileSystem fs = mock(JGitFileSystem.class); when(fs.getName()).thenReturn("fs"); manager = createFSManager(); manager.newFileSystem(() -> new HashMap<>(), () -> git, () -> fs.getName(), () -> mock(CredentialsProvider.class), () -> mock(JGitFileSystemsEventsManager.class), () -> null); assertTrue(manager.containsKey("fs")); assertTrue(manager.containsRoot("fs")); assertThat(manager.get("fs").toString()).isEqualTo("git: final JGitFileSystemImpl newFileSystem = new JGitFileSystemImpl(fsProvider, new Maps.Builder<String, String>() .put("ssh", "localhost") .build(), git, manager.createLock(git), fs.getName(), mock(CredentialsProvider.class), null, null); manager.updateFSCacheEntry("fs", newFileSystem); assertThat(manager.get("fs").toString()).isEqualTo("ssh: assertTrue(manager.containsKey("fs")); assertTrue(manager.containsRoot("fs")); }