private FileSystem getFileSystem() throws URISyntaxException { URI uri = new URI("test:///some/path"); Map<String, ?> env = Collections.emptyMap(); final FileSystem fileSystem = ioService.newFileSystem(uri, env); final Path fsRootDirectory1 = mock(JGitPathImpl.class); when(fsRootDirectory1.getFileSystem()).thenReturn(fileSystem); when(fsRootDirectory1.getRoot()).thenReturn(fsRootDirectory1); when(((JGitPathImpl) fsRootDirectory1).getAttrStorage()).thenReturn(mock(AttrsStorage.class)); final Path fsRootDirectory2 = mock(JGitPathImpl.class); when(fsRootDirectory2.getFileSystem()).thenReturn(fileSystem); when(fsRootDirectory2.getRoot()).thenReturn(fsRootDirectory2); when(((JGitPathImpl) fsRootDirectory2).getAttrStorage()).thenReturn(mock(AttrsStorage.class)); final Collection<Path> fsRootDirectories = Arrays.asList(fsRootDirectory1, fsRootDirectory2); doReturn(fsRootDirectories).when(fileSystem).getRootDirectories(); return fileSystem; } }
private FileSystem getFileSystem() throws URISyntaxException { URI uri = new URI("test:///some/path"); Map<String, ?> env = Collections.emptyMap(); final FileSystem fileSystem = ioService.newFileSystem(uri, env); final Path fsRootDirectory1 = mock(JGitPathImpl.class); when(fsRootDirectory1.getFileSystem()).thenReturn(fileSystem); when(fsRootDirectory1.getRoot()).thenReturn(fsRootDirectory1); when(((JGitPathImpl) fsRootDirectory1).getAttrStorage()).thenReturn(mock(AttrsStorage.class)); final Path fsRootDirectory2 = mock(JGitPathImpl.class); when(fsRootDirectory2.getFileSystem()).thenReturn(fileSystem); when(fsRootDirectory2.getRoot()).thenReturn(fsRootDirectory2); when(((JGitPathImpl) fsRootDirectory2).getAttrStorage()).thenReturn(mock(AttrsStorage.class)); final Collection<Path> fsRootDirectories = Arrays.asList(fsRootDirectory1, fsRootDirectory2); doReturn(fsRootDirectories).when(fileSystem).getRootDirectories(); return fileSystem; } }