Skip to content

Commit 04795fe

Browse files
chowderAudricV
andcommitted
Use Stream API for ShortFormContent#testShortFormContent
Co-authored-by: AudricV <74829229+AudricV@users.noreply.github.com>
1 parent 975b38a commit 04795fe

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,13 @@ private String getUrlEncodedQuery() {
412412
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
413413

414414
@Test
415-
public void testShortFormContent() throws IOException, ExtractionException {
416-
final List<InfoItem> items = extractor.getInitialPage().getItems();
417-
boolean hasShortFormContent = false;
418-
for (InfoItem item : items) {
419-
if (((StreamInfoItem) item).isShortFormContent()) {
420-
hasShortFormContent = true;
421-
break;
422-
}
423-
}
424-
425-
assertTrue(hasShortFormContent);
415+
void testShortFormContent() throws IOException, ExtractionException {
416+
assertTrue(extractor.getInitialPage()
417+
.getItems()
418+
.stream()
419+
.filter(StreamInfoItem.class::isInstance)
420+
.map(StreamInfoItem.class::cast)
421+
.anyMatch(StreamInfoItem::isShortFormContent));
426422
}
427423
}
428424
}

0 commit comments

Comments
 (0)