|
7 | 7 | import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor; |
8 | 8 | import org.schabi.newpipe.extractor.stream.DeliveryMethod; |
9 | 9 | import org.schabi.newpipe.extractor.stream.Stream; |
| 10 | +import org.schabi.newpipe.extractor.stream.VideoStream; |
10 | 11 | import org.w3c.dom.Document; |
11 | 12 | import org.w3c.dom.Element; |
12 | 13 | import org.w3c.dom.NodeList; |
|
26 | 27 | import static org.junit.jupiter.api.Assertions.assertNotEquals; |
27 | 28 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
28 | 29 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 30 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
29 | 31 | import static org.junit.jupiter.api.Assertions.assertTrue; |
30 | 32 | import static org.schabi.newpipe.extractor.ServiceList.YouTube; |
31 | 33 | import static org.schabi.newpipe.extractor.utils.Utils.isBlank; |
@@ -96,14 +98,14 @@ void testProgressiveStreamsANewEraOfOpen() throws Exception { |
96 | 98 | extractor.getVideoOnlyStreams()); |
97 | 99 | testStreams(DeliveryMethod.PROGRESSIVE_HTTP, |
98 | 100 | extractor.getAudioStreams()); |
99 | | - try { |
100 | | - testStreams(DeliveryMethod.PROGRESSIVE_HTTP, |
101 | | - extractor.getVideoStreams()); |
102 | | - } catch (final Exception e) { |
103 | | - assertEquals(YoutubeDashManifestCreator.YoutubeDashManifestCreationException.class, |
104 | | - e.getClass(), "The exception thrown was not the one excepted: " |
105 | | - + e.getClass().getName() |
106 | | - + "was thrown instead of YoutubeDashManifestCreationException"); |
| 101 | + // This exception should be always thrown, as we are not able to generate DASH |
| 102 | + // manifests of video formats with audio |
| 103 | + final List<VideoStream> videoStreams = extractor.getVideoStreams(); |
| 104 | + if (!videoStreams.isEmpty()) { |
| 105 | + assertThrows(YoutubeDashManifestCreator.YoutubeDashManifestCreationException.class, |
| 106 | + () -> testStreams(DeliveryMethod.PROGRESSIVE_HTTP, videoStreams), |
| 107 | + "The exception thrown for the generation of DASH manifests for YouTube " |
| 108 | + + "progressive video streams with audio was not the one excepted"); |
107 | 109 | } |
108 | 110 | } |
109 | 111 |
|
@@ -145,7 +147,7 @@ private void testStreams(@Nonnull final DeliveryMethod deliveryMethodToTest, |
145 | 147 | assertFalse(isBlank(dashManifest), "The DASH manifest is null or empty: " |
146 | 148 | + dashManifest); |
147 | 149 | } |
148 | | - i++; |
| 150 | + ++i; |
149 | 151 | } |
150 | 152 | } |
151 | 153 |
|
|
0 commit comments