@Test public void simpleRootTests() throws URISyntaxException { final SimpleFileSystemProvider fs = new SimpleFileSystemProvider(); final FileSystem fileSystem = new SimpleUnixFileSystem( fsProvider, "/" ); assertThat( fileSystem.getPath( "/" ) ).isEqualTo( fileSystem.getPath( "/path" ).getParent() ); final URL parentUrl = this.getClass().getResource( "/" ); final Path parentNioPath = fs.getPath( parentUrl.toURI() ); final URL childUrl = this.getClass().getResource( "/Folder" ); final Path childNioPath = fs.getPath( childUrl.toURI() ); final Path childParentNioPath = childNioPath.getParent(); System.out.println( parentNioPath ); assertThat( parentNioPath ).isEqualTo( childParentNioPath ); }
@Test public void whenGettingAudioTracks_thenDelegatesToTrackSelector() { given(trackSelector.getAudioTracks(any(RendererTypeRequester.class))).willReturn(AUDIO_TRACKS); AudioTracks audioTracks = facade.getAudioTracks(); assertThat(audioTracks).isEqualTo(AUDIO_TRACKS); }
@Test public void givenTrackSelectorContainsUnsupportedTracks_whenGettingAudioTracks_thenReturnsOnlySupportedTracks() { givenTrackSelectorContainsUnsupportedTracks(); AudioTracks audioTracks = trackSelector.getAudioTracks(mediaPlayer); assertThat(audioTracks).isEqualTo(expectedAudioTrack()); }
@Test public void givenTrackSelectorContainsUnsupportedTracks_whenGettingAudioTracks_thenReturnsOnlySupportedTracks() { givenTrackSelectorContainsUnsupportedTracks(); AudioTracks actualAudioTracks = exoPlayerAudioTrackSelector.getAudioTracks(rendererTypeRequester); assertThat(actualAudioTracks).isEqualTo(expectedSupportedAudioTracks()); }
@Test public void whenGettingAudioTracks_thenDelegatesToMediaPlayer() { given(mediaPlayer.getAudioTracks()).willReturn(AUDIO_TRACKS); AudioTracks audioTracks = player.getAudioTracks(); assertThat(audioTracks).isEqualTo(AUDIO_TRACKS); }
@Test public void testSimpleBranchedGit() { final Path path = JGitPathImpl.create(fs, "", "master@my-host", false); assertThat(path).isNotNull(); assertThat(path.isAbsolute()).isTrue(); assertThat(path.toString()).isEqualTo("/"); assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/"); assertThat(path.getRoot()).isEqualTo(path); assertThat(path.getNameCount()).isEqualTo(0); assertThat(path.getRoot()).isNotNull().isEqualTo(path); }
@Test public void whenGettingAudioTracks_thenDelegatesToTrackSelector() { givenMediaPlayerIsPrepared(); given(trackSelector.getAudioTracks(mediaPlayer)).willReturn(AUDIO_TRACKS); AudioTracks audioTracks = facade.getAudioTracks(); assertThat(audioTracks).isEqualTo(AUDIO_TRACKS); }
@Test public void testPathEqualsWithDifferentRepos() throws IOException, GitAPIException { final JGitFileSystemProvider fsProvider = mock( JGitFileSystemProvider.class ); final Git git1 = setupGit(); final JGitFileSystem fileSystem1 = new JGitFileSystem( fsProvider, null, git1, "my-repo1", CredentialsProvider.getDefault() ); final Git git2 = setupGit(); final JGitFileSystem fileSystem2 = new JGitFileSystem( fsProvider, null, git2, "my-repo2", CredentialsProvider.getDefault() ); final Path path1 = fileSystem1.getPath( "master", "/path/to/some.txt" ); final Path path2 = fileSystem2.getPath( "master", "/path/to/some.txt" ); assertThat( path1 ).isNotEqualTo( path2 ); assertThat( path1 ).isEqualTo( fileSystem1.getPath( "/path/to/some.txt" ) ); }
@Test public void simpleTests() { final FileSystem fileSystem = new SimpleUnixFileSystem( fsProvider, "/" ); assertThat( fileSystem.isOpen() ).isTrue(); assertThat( fileSystem.isReadOnly() ).isFalse(); assertThat( fileSystem.getSeparator() ).isEqualTo( System.getProperty( "file.separator" ) ); assertThat( fileSystem.provider() ).isEqualTo( fsProvider ); assertThat( fileSystem.supportedFileAttributeViews() ).isNotEmpty().hasSize( 1 ).contains( "basic" ); assertThat( fileSystem.getPath( "/path/to/file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "/path/to/file.txt", false ) ); assertThat( fileSystem.getPath( "/path/to/file.txt", null ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "/path/to/file.txt", false ) ); assertThat( fileSystem.getPath( "/path", "to", "file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "/path/to/file.txt", false ) ); try { fileSystem.close(); fail( "can't close this fileSystem" ); } catch ( UnsupportedOperationException ex ) { } assertThat( fileSystem.getFileStores() ).isNotNull().hasSize( 1 ); assertThat( fileSystem.getFileStores().iterator().next().name() ).isEqualTo( "/" ); assertThat( fileSystem.getRootDirectories() ).isNotNull().hasSize( 1 ); assertThat( fileSystem.getRootDirectories().iterator().next().toString() ).isEqualTo( "/" ); assertThat( fileSystem.getRootDirectories().iterator().next().isAbsolute() ).isTrue(); }
@Test public void simpleTests() { final FileSystem fileSystem = new SimpleWindowsFileSystem( roots, fsProvider, "c:\\" ); assertThat( fileSystem.isOpen() ).isTrue(); assertThat( fileSystem.isReadOnly() ).isFalse(); assertThat( fileSystem.getSeparator() ).isEqualTo( "\\" ); assertThat( fileSystem.provider() ).isEqualTo( fsProvider ); assertThat( fileSystem.supportedFileAttributeViews() ).isNotEmpty().hasSize( 1 ).contains( "basic" ); assertThat( fileSystem.getPath( "c:\\path\\to\\file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "c:\\path\\to\\file.txt", false ) ); assertThat( fileSystem.getPath( "c:\\path\\to\\file.txt", null ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "c:\\path\\to\\file.txt", false ) ); assertThat( fileSystem.getPath( "c:\\path", "to", "file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "c:\\path\\to\\file.txt", false ) ); try { fileSystem.close(); fail( "can't close this fileSystem" ); } catch ( UnsupportedOperationException ex ) { } assertThat( fileSystem.getFileStores() ).isNotNull().hasSize( 2 ); assertThat( fileSystem.getFileStores().iterator().next().name() ).isEqualTo( "c:\\" ); assertThat( fileSystem.getRootDirectories() ).isNotNull().hasSize( 2 ); assertThat( fileSystem.getRootDirectories().iterator().next().toString() ).isEqualTo( "c:\\" ); assertThat( fileSystem.getRootDirectories().iterator().next().isAbsolute() ).isTrue(); }