From 26596215fad04807968fb344588a52d5811c5f88 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sat, 19 Mar 2022 14:53:19 +0100 Subject: [PATCH] Refactored ``MediaCCCRecentListExtractorTest`` --- .../MediaCCCRecentListExtractorTest.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCRecentListExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCRecentListExtractorTest.java index 0493d3ff..6915859c 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCRecentListExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCRecentListExtractorTest.java @@ -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 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" + ) ); } }