mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-04-06 18:57:01 +00:00
[#11930] @Test export_justUrls()
This commit is contained in:
parent
2339f51ad4
commit
94d4c21cc7
@ -1,5 +1,6 @@
|
||||
package org.schabi.newpipe.local.playlist;
|
||||
|
||||
import static org.schabi.newpipe.local.playlist.PlayListShareMode.JUST_URLS;
|
||||
import static org.schabi.newpipe.local.playlist.PlayListShareMode.YOUTUBE_TEMP_PLAYLIST;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -15,23 +16,45 @@ import java.util.stream.Stream;
|
||||
public class LocalPlaylistFragmentTest {
|
||||
|
||||
@Test
|
||||
public void youTubeTempPlaylist() {
|
||||
public void export_asYouTubeTempPlaylist() {
|
||||
|
||||
Stream<StreamEntity> entityStream = List.of(
|
||||
Stream<StreamEntity> entityStream = asStreamEntityStream(
|
||||
|
||||
"https://www.youtube.com/watch?v=1"
|
||||
,"https://www.youtube.com/watch?v=2"
|
||||
,"https://www.youtube.com/watch?v=3"
|
||||
)
|
||||
.stream()
|
||||
.map(LocalPlaylistFragmentTest::newStreamEntity)
|
||||
;
|
||||
);
|
||||
|
||||
String url = LocalPlaylistFragment.export(YOUTUBE_TEMP_PLAYLIST, entityStream, null);
|
||||
|
||||
Assert.assertEquals("http://www.youtube.com/watch_videos?video_ids=1,2,3", url);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void export_justUrls() {
|
||||
|
||||
Stream<StreamEntity> entityStream = asStreamEntityStream(
|
||||
|
||||
"https://www.youtube.com/watch?v=1"
|
||||
,"https://www.youtube.com/watch?v=2"
|
||||
,"https://www.youtube.com/watch?v=3"
|
||||
);
|
||||
|
||||
String exported = LocalPlaylistFragment.export(JUST_URLS, entityStream, null);
|
||||
|
||||
Assert.assertEquals("""
|
||||
https://www.youtube.com/watch?v=1
|
||||
https://www.youtube.com/watch?v=2
|
||||
https://www.youtube.com/watch?v=3""", exported);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static Stream<StreamEntity> asStreamEntityStream(String... urls) {
|
||||
|
||||
return Stream.of(urls)
|
||||
.map(LocalPlaylistFragmentTest::newStreamEntity);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
static StreamEntity newStreamEntity(String url) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user