2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-31 06:15:37 +00:00

Use easier-to-read asserts statements in tests

This commit is contained in:
Mauricio Colli
2020-03-23 18:08:59 -03:00
parent c921e5d6a5
commit 0a20c53f1a

View File

@@ -4,8 +4,8 @@ import org.junit.Test;
import org.schabi.newpipe.extractor.Extractor;
import org.schabi.newpipe.extractor.StreamingService;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
public abstract class DefaultExtractorTest<T extends Extractor> implements BaseExtractorTest {
@@ -39,21 +39,15 @@ public abstract class DefaultExtractorTest<T extends Extractor> implements BaseE
@Override
public void testUrl() throws Exception {
final String url = extractor().getUrl();
final String expectedContains = expectedUrlContains();
assertIsSecureUrl(url);
assertTrue("Url \"" + url + "\" doesn't contains \"" + expectedContains + "\"",
url.contains(expectedContains));
assertThat(url, containsString(expectedUrlContains()));
}
@Test
@Override
public void testOriginalUrl() throws Exception {
final String originalUrl = extractor().getOriginalUrl();
final String expectedContains = expectedOriginalUrlContains();
assertIsSecureUrl(originalUrl);
assertTrue("Original url \"" + originalUrl + "\" doesn't contains \"" + expectedContains + "\"",
originalUrl.contains(expectedContains));
assertThat(originalUrl, containsString(expectedOriginalUrlContains()));
}
}