Skip to content

Commit 0bef5a6

Browse files
committed
[MediaCCC] Apply changes in extractor tests
Also remove some public test methods modifiers.
1 parent 74fc542 commit 0bef5a6

2 files changed

Lines changed: 38 additions & 24 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCConferenceExtractorTest.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import static org.junit.jupiter.api.Assertions.assertEquals;
1010
import static org.junit.jupiter.api.Assertions.assertTrue;
11+
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContainsImageUrlInImageCollection;
1112
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
1213

1314
/**
@@ -25,27 +26,29 @@ public static void setUpClass() throws Exception {
2526
}
2627

2728
@Test
28-
public void testName() throws Exception {
29+
void testName() throws Exception {
2930
assertEquals("FrOSCon 2017", extractor.getName());
3031
}
3132

3233
@Test
33-
public void testGetUrl() throws Exception {
34+
void testGetUrl() throws Exception {
3435
assertEquals("https://media.ccc.de/c/froscon2017", extractor.getUrl());
3536
}
3637

3738
@Test
38-
public void testGetOriginalUrl() throws Exception {
39+
void testGetOriginalUrl() throws Exception {
3940
assertEquals("https://media.ccc.de/c/froscon2017", extractor.getOriginalUrl());
4041
}
4142

4243
@Test
43-
public void testGetThumbnailUrl() throws Exception {
44-
assertEquals("https://static.media.ccc.de/media/events/froscon/2017/logo.png", extractor.getAvatarUrl());
44+
void testGetThumbnails() {
45+
assertContainsImageUrlInImageCollection(
46+
"https://static.media.ccc.de/media/events/froscon/2017/logo.png",
47+
extractor.getAvatars());
4548
}
4649

4750
@Test
48-
public void testGetInitalPage() throws Exception {
51+
void testGetInitalPage() {
4952
assertEquals(97, extractor.getInitialPage().getItems().size());
5053
}
5154
}
@@ -61,27 +64,29 @@ public static void setUpClass() throws Exception {
6164
}
6265

6366
@Test
64-
public void testName() throws Exception {
67+
void testName() throws Exception {
6568
assertEquals("Open Source Conference Albania 2019", extractor.getName());
6669
}
6770

6871
@Test
69-
public void testGetUrl() throws Exception {
72+
void testGetUrl() throws Exception {
7073
assertEquals("https://media.ccc.de/c/oscal19", extractor.getUrl());
7174
}
7275

7376
@Test
74-
public void testGetOriginalUrl() throws Exception {
77+
void testGetOriginalUrl() throws Exception {
7578
assertEquals("https://media.ccc.de/c/oscal19", extractor.getOriginalUrl());
7679
}
7780

7881
@Test
79-
public void testGetThumbnailUrl() throws Exception {
80-
assertEquals("https://static.media.ccc.de/media/events/oscal/2019/oscal-19.png", extractor.getAvatarUrl());
82+
void testGetThumbnailUrl() {
83+
assertContainsImageUrlInImageCollection(
84+
"https://static.media.ccc.de/media/events/oscal/2019/oscal-19.png",
85+
extractor.getAvatars());
8186
}
8287

8388
@Test
84-
public void testGetInitalPage() throws Exception {
89+
void testGetInitalPage() {
8590
assertTrue(extractor.getInitialPage().getItems().size() >= 21);
8691
}
8792
}

extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.Locale;
1818

1919
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContainsImageUrlInImageCollection;
2021
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
2122

2223
/**
@@ -62,16 +63,20 @@ public static void setUp() throws Exception {
6263

6364
@Override
6465
@Test
65-
public void testThumbnailUrl() throws Exception {
66-
super.testThumbnailUrl();
67-
assertEquals("https://static.media.ccc.de/media/events/gpn/gpn18/105-hd.jpg", extractor.getThumbnailUrl());
66+
public void testThumbnails() throws Exception {
67+
super.testThumbnails();
68+
assertContainsImageUrlInImageCollection(
69+
"https://static.media.ccc.de/media/events/gpn/gpn18/105-hd_preview.jpg",
70+
extractor.getThumbnails());
6871
}
6972

7073
@Override
7174
@Test
72-
public void testUploaderAvatarUrl() throws Exception {
73-
super.testUploaderAvatarUrl();
74-
assertEquals("https://static.media.ccc.de/media/events/gpn/gpn18/logo.png", extractor.getUploaderAvatarUrl());
75+
public void testUploaderAvatars() throws Exception {
76+
super.testUploaderAvatars();
77+
assertContainsImageUrlInImageCollection(
78+
"https://static.media.ccc.de/media/events/gpn/gpn18/logo.png",
79+
extractor.getUploaderAvatars());
7580
}
7681

7782
@Override
@@ -132,16 +137,20 @@ public static void setUp() throws Exception {
132137

133138
@Override
134139
@Test
135-
public void testThumbnailUrl() throws Exception {
136-
super.testThumbnailUrl();
137-
assertEquals("https://static.media.ccc.de/media/congress/2019/10565-hd.jpg", extractor.getThumbnailUrl());
140+
public void testThumbnails() throws Exception {
141+
super.testThumbnails();
142+
assertContainsImageUrlInImageCollection(
143+
"https://static.media.ccc.de/media/congress/2019/10565-hd_preview.jpg",
144+
extractor.getThumbnails());
138145
}
139146

140147
@Override
141148
@Test
142-
public void testUploaderAvatarUrl() throws Exception {
143-
super.testUploaderAvatarUrl();
144-
assertEquals("https://static.media.ccc.de/media/congress/2019/logo.png", extractor.getUploaderAvatarUrl());
149+
public void testUploaderAvatars() throws Exception {
150+
super.testUploaderAvatars();
151+
assertContainsImageUrlInImageCollection(
152+
"https://static.media.ccc.de/media/congress/2019/logo.png",
153+
extractor.getUploaderAvatars());
145154
}
146155

147156
@Override

0 commit comments

Comments
 (0)