|
5 | 5 | import static org.junit.jupiter.api.Assertions.assertNotEquals; |
6 | 6 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
7 | 7 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 8 | +import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains; |
8 | 9 | import static org.schabi.newpipe.extractor.ExtractorAsserts.assertGreater; |
9 | 10 | import static org.schabi.newpipe.extractor.ServiceList.YouTube; |
10 | 11 | import static org.schabi.newpipe.extractor.comments.CommentsInfoItem.UNKNOWN_REPLY_COUNT; |
@@ -344,4 +345,32 @@ public void testGetCommentsReplyCount() throws IOException, ExtractionException |
344 | 345 | assertGreater(300, firstComment.getReplyCount()); |
345 | 346 | } |
346 | 347 | } |
| 348 | + |
| 349 | + public static class FormattingTest { |
| 350 | + |
| 351 | + private final static String url = "https://www.youtube.com/watch?v=zYpyS2HaZHM"; |
| 352 | + |
| 353 | + private static YoutubeCommentsExtractor extractor; |
| 354 | + |
| 355 | + @BeforeAll |
| 356 | + public static void setUp() throws Exception { |
| 357 | + YoutubeTestsUtils.ensureStateless(); |
| 358 | + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "formatting")); |
| 359 | + extractor = (YoutubeCommentsExtractor) YouTube |
| 360 | + .getCommentsExtractor(url); |
| 361 | + extractor.fetchPage(); |
| 362 | + } |
| 363 | + |
| 364 | + @Test |
| 365 | + public void testGetCommentsFormatting() throws IOException, ExtractionException { |
| 366 | + final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage(); |
| 367 | + |
| 368 | + DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors()); |
| 369 | + |
| 370 | + final CommentsInfoItem firstComment = comments.getItems().get(0); |
| 371 | + |
| 372 | + assertContains("<s>", firstComment.getCommentText()); |
| 373 | + assertContains("<b>", firstComment.getCommentText()); |
| 374 | + } |
| 375 | + } |
347 | 376 | } |
0 commit comments