Refactored `MediaCCCRecentListExtractorTest`

This commit is contained in:
litetex 2022-03-19 14:53:19 +01:00
parent 53962bfd7d
commit 26596215fa

View file

@ -1,5 +1,11 @@
package org.schabi.newpipe.extractor.services.media_ccc;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertGreater;
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
@ -8,15 +14,9 @@ import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.*;
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
public class MediaCCCRecentListExtractorTest {
private static KioskExtractor extractor;
@ -37,9 +37,14 @@ public class MediaCCCRecentListExtractorTest {
private Stream<Executable> getAllConditionsForItem(final StreamInfoItem item) {
return Stream.of(
() -> assertFalse(isNullOrEmpty(item.getName())),
() -> assertTrue(item.getDuration() > 0,
"Duration[=" + item.getDuration() + "] of " + item + "is <= 0")
() -> assertFalse(
isNullOrEmpty(item.getName()),
"Name=[" + item.getName() + "] of " + item + " is empty or null"
),
() -> assertGreater(0,
item.getDuration(),
"Duration[=" + item.getDuration() + "] of " + item + " is <= 0"
)
);
}
}