Add test for formatting.
This commit is contained in:
parent
52fda37915
commit
1d3d7fa5c3
1 changed files with 29 additions and 0 deletions
|
@ -5,6 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertGreater;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static org.schabi.newpipe.extractor.comments.CommentsInfoItem.UNKNOWN_REPLY_COUNT;
|
||||
|
@ -344,4 +345,32 @@ public class YoutubeCommentsExtractorTest {
|
|||
assertGreater(300, firstComment.getReplyCount());
|
||||
}
|
||||
}
|
||||
|
||||
public static class FormattingTest {
|
||||
|
||||
private final static String url = "https://www.youtube.com/watch?v=zYpyS2HaZHM";
|
||||
|
||||
private static YoutubeCommentsExtractor extractor;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
YoutubeTestsUtils.ensureStateless();
|
||||
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "formatting"));
|
||||
extractor = (YoutubeCommentsExtractor) YouTube
|
||||
.getCommentsExtractor(url);
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsFormatting() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
|
||||
final CommentsInfoItem firstComment = comments.getItems().get(0);
|
||||
|
||||
assertContains("<s>", firstComment.getCommentText());
|
||||
assertContains("<b>", firstComment.getCommentText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue