33import org .junit .jupiter .api .BeforeAll ;
44import org .junit .jupiter .api .Test ;
55import org .schabi .newpipe .downloader .DownloaderTestImpl ;
6+ import org .schabi .newpipe .extractor .InfoItem ;
67import org .schabi .newpipe .extractor .NewPipe ;
8+ import org .schabi .newpipe .extractor .StreamingService ;
9+ import org .schabi .newpipe .extractor .channel .tabs .ChannelTabExtractor ;
710import org .schabi .newpipe .extractor .channel .tabs .ChannelTabs ;
811import org .schabi .newpipe .extractor .exceptions .ParsingException ;
912import org .schabi .newpipe .extractor .services .BaseListExtractorTest ;
13+ import org .schabi .newpipe .extractor .services .DefaultListExtractorTest ;
1014import org .schabi .newpipe .extractor .services .peertube .extractors .PeertubeChannelTabExtractor ;
1115
1216import static org .junit .jupiter .api .Assertions .assertEquals ;
1620
1721class PeertubeAccountTabExtractorTest {
1822
19- static class Videos implements BaseListExtractorTest {
23+ static class Videos extends DefaultListExtractorTest < ChannelTabExtractor > {
2024 private static PeertubeChannelTabExtractor extractor ;
2125
2226 @ BeforeAll
@@ -29,60 +33,17 @@ static void setUp() throws Exception {
2933 extractor .fetchPage ();
3034 }
3135
32- /*//////////////////////////////////////////////////////////////////////////
33- // Extractor
34- //////////////////////////////////////////////////////////////////////////*/
35-
36- @ Test
37- @ Override
38- public void testServiceId () {
39- assertEquals (PeerTube .getServiceId (), extractor .getServiceId ());
40- }
41-
42- @ Test
43- @ Override
44- public void testName () throws ParsingException {
45- assertEquals (ChannelTabs .VIDEOS , extractor .getName ());
46- }
47-
48- @ Test
49- @ Override
50- public void testId () throws ParsingException {
51- assertEquals ("accounts/framasoft" , extractor .getId ());
52- }
53-
54- @ Test
55- @ Override
56- public void testUrl () throws ParsingException {
57- assertEquals ("https://framatube.org/accounts/framasoft/videos" ,
58- extractor .getUrl ());
59- }
60-
61- @ Test
62- @ Override
63- public void testOriginalUrl () throws ParsingException {
64- assertEquals ("https://framatube.org/accounts/framasoft/videos" ,
65- extractor .getOriginalUrl ());
66- }
67-
68- /*//////////////////////////////////////////////////////////////////////////
69- // ListExtractor
70- //////////////////////////////////////////////////////////////////////////*/
71-
72- @ Test
73- @ Override
74- public void testRelatedItems () throws Exception {
75- defaultTestRelatedItems (extractor );
76- }
77-
78- @ Test
79- @ Override
80- public void testMoreRelatedItems () throws Exception {
81- defaultTestMoreItems (extractor );
82- }
36+ @ Override public ChannelTabExtractor extractor () throws Exception { return extractor ; }
37+ @ Override public StreamingService expectedService () throws Exception { return PeerTube ; }
38+ @ Override public String expectedName () throws Exception { return ChannelTabs .VIDEOS ; }
39+ @ Override public String expectedId () throws Exception { return "accounts/framasoft" ; }
40+ @ Override public String expectedUrlContains () throws Exception { return "https://framatube.org/accounts/framasoft/videos" ; }
41+ @ Override public String expectedOriginalUrlContains () throws Exception { return "https://framatube.org/accounts/framasoft/videos" ; }
42+ @ Override public InfoItem .InfoType expectedInfoItemType () { return InfoItem .InfoType .STREAM ; }
43+ @ Override public boolean expectedHasMoreItems () { return true ; }
8344 }
8445
85- static class Channels implements BaseListExtractorTest {
46+ static class Channels extends DefaultListExtractorTest < ChannelTabExtractor > {
8647 private static PeertubeChannelTabExtractor extractor ;
8748
8849 @ BeforeAll
@@ -95,56 +56,13 @@ static void setUp() throws Exception {
9556 extractor .fetchPage ();
9657 }
9758
98- /*//////////////////////////////////////////////////////////////////////////
99- // Extractor
100- //////////////////////////////////////////////////////////////////////////*/
101-
102- @ Test
103- @ Override
104- public void testServiceId () {
105- assertEquals (PeerTube .getServiceId (), extractor .getServiceId ());
106- }
107-
108- @ Test
109- @ Override
110- public void testName () throws ParsingException {
111- assertEquals (ChannelTabs .CHANNELS , extractor .getName ());
112- }
113-
114- @ Test
115- @ Override
116- public void testId () throws ParsingException {
117- assertEquals ("accounts/framasoft" , extractor .getId ());
118- }
119-
120- @ Test
121- @ Override
122- public void testUrl () throws ParsingException {
123- assertEquals ("https://framatube.org/accounts/framasoft/video-channels" ,
124- extractor .getUrl ());
125- }
126-
127- @ Test
128- @ Override
129- public void testOriginalUrl () throws ParsingException {
130- assertEquals ("https://framatube.org/accounts/framasoft/video-channels" ,
131- extractor .getOriginalUrl ());
132- }
133-
134- /*//////////////////////////////////////////////////////////////////////////
135- // ListExtractor
136- //////////////////////////////////////////////////////////////////////////*/
137-
138- @ Test
139- @ Override
140- public void testRelatedItems () throws Exception {
141- defaultTestRelatedItems (extractor );
142- }
143-
144- @ Test
145- @ Override
146- public void testMoreRelatedItems () throws Exception {
147- defaultTestMoreItems (extractor );
148- }
59+ @ Override public ChannelTabExtractor extractor () throws Exception { return extractor ; }
60+ @ Override public StreamingService expectedService () throws Exception { return PeerTube ; }
61+ @ Override public String expectedName () throws Exception { return ChannelTabs .CHANNELS ; }
62+ @ Override public String expectedId () throws Exception { return "accounts/framasoft" ; }
63+ @ Override public String expectedUrlContains () throws Exception { return "https://framatube.org/accounts/framasoft/video-channels" ; }
64+ @ Override public String expectedOriginalUrlContains () throws Exception { return "https://framatube.org/accounts/framasoft/video-channels" ; }
65+ @ Override public InfoItem .InfoType expectedInfoItemType () { return InfoItem .InfoType .CHANNEL ; }
66+ @ Override public boolean expectedHasMoreItems () { return true ; }
14967 }
15068}
0 commit comments