Skip to content

Commit 94d4c21

Browse files
committed
[TeamNewPipe#11930] @test export_justUrls()
1 parent 2339f51 commit 94d4c21

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

app/src/test/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragmentTest.java

+29-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.local.playlist;
22

3+
import static org.schabi.newpipe.local.playlist.PlayListShareMode.JUST_URLS;
34
import static org.schabi.newpipe.local.playlist.PlayListShareMode.YOUTUBE_TEMP_PLAYLIST;
45

56
import androidx.annotation.NonNull;
@@ -15,23 +16,45 @@
1516
public class LocalPlaylistFragmentTest {
1617

1718
@Test
18-
public void youTubeTempPlaylist() {
19+
public void export_asYouTubeTempPlaylist() {
1920

20-
Stream<StreamEntity> entityStream = List.of(
21+
Stream<StreamEntity> entityStream = asStreamEntityStream(
2122

2223
"https://www.youtube.com/watch?v=1"
2324
,"https://www.youtube.com/watch?v=2"
2425
,"https://www.youtube.com/watch?v=3"
25-
)
26-
.stream()
27-
.map(LocalPlaylistFragmentTest::newStreamEntity)
28-
;
26+
);
2927

3028
String url = LocalPlaylistFragment.export(YOUTUBE_TEMP_PLAYLIST, entityStream, null);
3129

3230
Assert.assertEquals("http://www.youtube.com/watch_videos?video_ids=1,2,3", url);
3331
}
3432

33+
@Test
34+
public void export_justUrls() {
35+
36+
Stream<StreamEntity> entityStream = asStreamEntityStream(
37+
38+
"https://www.youtube.com/watch?v=1"
39+
,"https://www.youtube.com/watch?v=2"
40+
,"https://www.youtube.com/watch?v=3"
41+
);
42+
43+
String exported = LocalPlaylistFragment.export(JUST_URLS, entityStream, null);
44+
45+
Assert.assertEquals("""
46+
https://www.youtube.com/watch?v=1
47+
https://www.youtube.com/watch?v=2
48+
https://www.youtube.com/watch?v=3""", exported);
49+
}
50+
51+
@NonNull
52+
private static Stream<StreamEntity> asStreamEntityStream(String... urls) {
53+
54+
return Stream.of(urls)
55+
.map(LocalPlaylistFragmentTest::newStreamEntity);
56+
}
57+
3558
@NonNull
3659
static StreamEntity newStreamEntity(String url) {
3760

0 commit comments

Comments
 (0)