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
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
1 changed files with 4 additions and 10 deletions

View File

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