2020-03-21 07:13:11 +01:00
|
|
|
package org.schabi.newpipe.extractor.services;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import org.junit.jupiter.api.Test;
|
2020-03-21 07:13:11 +01:00
|
|
|
import org.schabi.newpipe.extractor.Extractor;
|
2021-12-27 21:08:08 +01:00
|
|
|
import org.schabi.newpipe.extractor.ExtractorAsserts;
|
2020-03-21 07:13:11 +01:00
|
|
|
import org.schabi.newpipe.extractor.StreamingService;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
2020-03-21 07:13:11 +01:00
|
|
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
|
|
|
|
|
|
|
public abstract class DefaultExtractorTest<T extends Extractor> implements BaseExtractorTest {
|
|
|
|
public abstract T extractor() throws Exception;
|
|
|
|
|
|
|
|
public abstract StreamingService expectedService() throws Exception;
|
|
|
|
public abstract String expectedName() throws Exception;
|
|
|
|
public abstract String expectedId() throws Exception;
|
|
|
|
public abstract String expectedUrlContains() throws Exception;
|
|
|
|
public abstract String expectedOriginalUrlContains() throws Exception;
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Override
|
|
|
|
public void testServiceId() throws Exception {
|
|
|
|
assertEquals(expectedService().getServiceId(), extractor().getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Override
|
|
|
|
public void testName() throws Exception {
|
|
|
|
assertEquals(expectedName(), extractor().getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Override
|
|
|
|
public void testId() throws Exception {
|
|
|
|
assertEquals(expectedId(), extractor().getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Override
|
|
|
|
public void testUrl() throws Exception {
|
|
|
|
final String url = extractor().getUrl();
|
|
|
|
assertIsSecureUrl(url);
|
2021-12-27 21:08:08 +01:00
|
|
|
ExtractorAsserts.assertContains(expectedUrlContains(), url);
|
2020-03-21 07:13:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Override
|
|
|
|
public void testOriginalUrl() throws Exception {
|
|
|
|
final String originalUrl = extractor().getOriginalUrl();
|
|
|
|
assertIsSecureUrl(originalUrl);
|
2021-12-27 21:08:08 +01:00
|
|
|
ExtractorAsserts.assertContains(expectedOriginalUrlContains(), originalUrl);
|
2020-03-21 07:13:11 +01:00
|
|
|
}
|
|
|
|
}
|