Use Stream API for ShortFormContent#testShortFormContent

Co-authored-by: AudricV <74829229+AudricV@users.noreply.github.com>
This commit is contained in:
Caleb 2022-10-29 01:32:02 +01:00 committed by chowder
parent 975b38a0b9
commit 04795fe5d2
1 changed files with 7 additions and 11 deletions

View File

@ -412,17 +412,13 @@ public class YoutubeSearchExtractorTest {
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; } @Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
@Test @Test
public void testShortFormContent() throws IOException, ExtractionException { void testShortFormContent() throws IOException, ExtractionException {
final List<InfoItem> items = extractor.getInitialPage().getItems(); assertTrue(extractor.getInitialPage()
boolean hasShortFormContent = false; .getItems()
for (InfoItem item : items) { .stream()
if (((StreamInfoItem) item).isShortFormContent()) { .filter(StreamInfoItem.class::isInstance)
hasShortFormContent = true; .map(StreamInfoItem.class::cast)
break; .anyMatch(StreamInfoItem::isShortFormContent));
}
}
assertTrue(hasShortFormContent);
} }
} }
} }