Use Stream API for ShortFormContent#testShortFormContent
Co-authored-by: AudricV <74829229+AudricV@users.noreply.github.com>
This commit is contained in:
parent
975b38a0b9
commit
04795fe5d2
1 changed files with 7 additions and 11 deletions
|
@ -412,17 +412,13 @@ public class YoutubeSearchExtractorTest {
|
|||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
||||
|
||||
@Test
|
||||
public void testShortFormContent() throws IOException, ExtractionException {
|
||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
||||
boolean hasShortFormContent = false;
|
||||
for (InfoItem item : items) {
|
||||
if (((StreamInfoItem) item).isShortFormContent()) {
|
||||
hasShortFormContent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(hasShortFormContent);
|
||||
void testShortFormContent() throws IOException, ExtractionException {
|
||||
assertTrue(extractor.getInitialPage()
|
||||
.getItems()
|
||||
.stream()
|
||||
.filter(StreamInfoItem.class::isInstance)
|
||||
.map(StreamInfoItem.class::cast)
|
||||
.anyMatch(StreamInfoItem::isShortFormContent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue