diff --git a/src/test/java/com/github/felipeucelli/javatube/CaptionsTest.java b/src/test/java/com/github/felipeucelli/javatube/CaptionsTest.java deleted file mode 100644 index 539eceb..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/CaptionsTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - -import java.util.ArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -public class CaptionsTest { - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=4LdhxXL-RZ8", - "https://www.youtube.com/watch?v=jgCVkQhlScc", - "https://www.youtube.com/watch?v=wJnBTPUQS5A" - }) - public void testGetCaptionTracks(String linkToTest) throws Exception { - Assertions.assertFalse(new Youtube(linkToTest).getCaptionTracks().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=4LdhxXL-RZ8", - "https://www.youtube.com/watch?v=jgCVkQhlScc", - "https://www.youtube.com/watch?v=wJnBTPUQS5A" - }) - public void testXmlCaptionToSrt(String linkToTest) throws Exception { - String srtCaptions = new Youtube(linkToTest).getCaptions().getByCode("en").xmlCaptionToSrt(); - Pattern pattern = Pattern.compile("\\d+\\n\\d{2}:\\d{2}:\\d{2},\\d{3}\\s-->\\s\\d{2}:\\d{2}:\\d{2},\\d{3}\\n.*\\n"); - Matcher matcher = pattern.matcher(srtCaptions); - Assertions.assertTrue(matcher.find()); - - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=4LdhxXL-RZ8", - "https://www.youtube.com/watch?v=jgCVkQhlScc", - "https://www.youtube.com/watch?v=wJnBTPUQS5A" - }) - public void testGetUrl(String linkToTest) throws Exception { - ArrayList c = new Youtube(linkToTest).getCaptionTracks(); - for(Captions captions : c){ - Assertions.assertDoesNotThrow(captions::getUrl); - } - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=4LdhxXL-RZ8", - "https://www.youtube.com/watch?v=jgCVkQhlScc", - "https://www.youtube.com/watch?v=wJnBTPUQS5A" - }) - public void testGetCode(String linkToTest) throws Exception { - ArrayList c = new Youtube(linkToTest).getCaptionTracks(); - for(Captions captions : c){ - Assertions.assertDoesNotThrow(captions::getCode); - } - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=4LdhxXL-RZ8", - "https://www.youtube.com/watch?v=jgCVkQhlScc", - "https://www.youtube.com/watch?v=wJnBTPUQS5A" - }) - public void testGetName(String linkToTest) throws Exception { - ArrayList c = new Youtube(linkToTest).getCaptionTracks(); - for(Captions captions : c){ - Assertions.assertDoesNotThrow(captions::getName); - } - } -} diff --git a/src/test/java/com/github/felipeucelli/javatube/ChannelTest.java b/src/test/java/com/github/felipeucelli/javatube/ChannelTest.java deleted file mode 100644 index 57eb9a8..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/ChannelTest.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - -public class ChannelTest { - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic, https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds, https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetUrl(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Channel(linkToTest).getUrl()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic, Alan Walker", - "https://www.youtube.com/@NoCopyrightSounds, NoCopyrightSounds" - }) - public void testGetChannelName(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Channel(linkToTest).getChannelName()); - - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic, UCJrOtniJ0-NWz37R30urifQ", - "https://www.youtube.com/@NoCopyrightSounds, UC_aEa8K-EOJ3D6gOs7HcyNg" - }) - public void testGetChannelId(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Channel(linkToTest).getChannelId()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic, http://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds, http://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetVanityUrl(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Channel(linkToTest).getVanityUrl()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetViews(String linkToTest) throws Exception { - Assertions.assertNotNull(new Channel(linkToTest).getViews()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetSubscribers(String linkToTest) throws Exception { - Assertions.assertNotNull(new Channel(linkToTest).getSubscribers()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetKeywords(String linkToTest) throws Exception { - Assertions.assertFalse(new Channel(linkToTest).getKeywords().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetAvailableCountryCodes(String linkToTest) throws Exception { - Assertions.assertFalse(new Channel(linkToTest).getAvailableCountryCodes().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetLastUpdated(String linkToTest) throws Exception { - Assertions.assertNotNull(new Channel(linkToTest).getLastUpdated()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testLength(String linkToTest) throws Exception { - Assertions.assertNotNull(new Channel(linkToTest).length()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGetDescription(String linkToTest) throws Exception { - Assertions.assertFalse(new Channel(linkToTest).getDescription().isEmpty()); - } - - - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@NoCopyrightSounds" - }) - public void testGeThumbnailUrl(String linkToTest) throws Exception { - Assertions.assertNotNull(new Channel(linkToTest).getThumbnailUrl()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic" - }) - public void testGetVideos(String linkToTest) throws Exception { - Assertions.assertTrue(30 < new Channel(linkToTest).getVideos().size()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic", - "https://www.youtube.com/@spinninrecords", - "https://www.youtube.com/@NoCopyrightSounds", - "https://www.youtube.com/@Monstercat" - }) - public void testGetShorts(String linkToTest) throws Exception { - Assertions.assertTrue(48 < new Channel(linkToTest).getShorts().size()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@spinninrecords", - }) - public void testGetLives(String linkToTest) throws Exception { - Assertions.assertTrue(30 < new Channel(linkToTest).getLives().size()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic" - }) - public void testGetReleases(String linkToTest) throws Exception { - Assertions.assertTrue(28 < new Channel(linkToTest).getReleases().size()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/@Alanwalkermusic, 30", - "https://www.youtube.com/@Monstercat, 30" - }) - public void testGetPlaylists(String linkToTest, int expectedOutput) throws Exception { - Assertions.assertTrue(expectedOutput < new Channel(linkToTest).getPlaylists().size()); - } - -} diff --git a/src/test/java/com/github/felipeucelli/javatube/InnerTubeTest.java b/src/test/java/com/github/felipeucelli/javatube/InnerTubeTest.java deleted file mode 100644 index 809a88b..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/InnerTubeTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - -import java.net.HttpURLConnection; -import java.net.URL; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -public class InnerTubeTest { - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=60ItHLz5WEA, WEB", - "https://www.youtube.com/watch?v=60ItHLz5WEA, WEB_EMBED", - "https://www.youtube.com/watch?v=60ItHLz5WEA, WEB_MUSIC", - "https://www.youtube.com/watch?v=60ItHLz5WEA, WEB_CREATOR", - - "https://www.youtube.com/watch?v=60ItHLz5WEA, ANDROID", - "https://www.youtube.com/watch?v=60ItHLz5WEA, ANDROID_VR", - "https://www.youtube.com/watch?v=60ItHLz5WEA, ANDROID_MUSIC", - "https://www.youtube.com/watch?v=60ItHLz5WEA, ANDROID_CREATOR", - "https://www.youtube.com/watch?v=60ItHLz5WEA, ANDROID_TESTSUITE", - "https://www.youtube.com/watch?v=60ItHLz5WEA, ANDROID_PRODUCER", - - "https://www.youtube.com/watch?v=60ItHLz5WEA, IOS", - "https://www.youtube.com/watch?v=60ItHLz5WEA, IOS_MUSIC", - "https://www.youtube.com/watch?v=60ItHLz5WEA, IOS_CREATOR", - - "https://www.youtube.com/watch?v=60ItHLz5WEA, MWEB", - - "https://www.youtube.com/watch?v=60ItHLz5WEA, TV_EMBED", - - "https://www.youtube.com/watch?v=60ItHLz5WEA, MEDIA_CONNECT" - }) - public void testGetStreamData(String linkToTest, String client) { - assertDoesNotThrow(() -> - Assertions.assertNotNull(new Youtube(linkToTest, client).streamData()) - ); - } -} \ No newline at end of file diff --git a/src/test/java/com/github/felipeucelli/javatube/PlaylistTest.java b/src/test/java/com/github/felipeucelli/javatube/PlaylistTest.java deleted file mode 100644 index e97fdb6..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/PlaylistTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - - -public class PlaylistTest { - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj, https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u, https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u" - }) - public void testGetUrl(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Playlist(linkToTest).getUrl()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj, Pop Music Playlist - Timeless Pop Songs (Updated Weekly 2024)", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u, Best Pop Music Videos - Top Pop Hits Playlist" - }) - public void testGetTitle(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Playlist(linkToTest).getTitle()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u" - }) - public void testLength(String linkToTest) throws Exception { - Assertions.assertTrue(100 < Integer.parseInt(new Playlist(linkToTest).length().replace(",", ""))); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u" - }) - public void testGetVideos(String linkToTest) throws Exception { - Assertions.assertTrue(100 < new Playlist(linkToTest).getVideos().size()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u" - }) - public void testGetViews(String linkToTest) throws Exception { - Assertions.assertNotNull(new Playlist(linkToTest).getViews()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj, by Redlist - Just Hits", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u, Redlist - Just Hits" - }) - public void testGetOwner(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Playlist(linkToTest).getOwner()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj, https://www.youtube.com/channel/UCs72iRpTEuwV3y6pdWYLgiw", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u, https://www.youtube.com/channel/UCs72iRpTEuwV3y6pdWYLgiw" - }) - public void testGetOwnerUrl(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Playlist(linkToTest).getOwnerUrl()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj, UCs72iRpTEuwV3y6pdWYLgiw", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u, UCs72iRpTEuwV3y6pdWYLgiw" - }) - public void testGetOwnerId(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Playlist(linkToTest).getOwnerId()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj", - "https://www.youtube.com/playlist?list=PLMC9KNkIncKtGvr2kFRuXBVmBev6cAJ2u" - }) - public void testGetLastUpdated(String linkToTest) throws Exception { - Assertions.assertNotNull(new Playlist(linkToTest).getLastUpdated()); - } - -} diff --git a/src/test/java/com/github/felipeucelli/javatube/SearchTest.java b/src/test/java/com/github/felipeucelli/javatube/SearchTest.java deleted file mode 100644 index 3513022..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/SearchTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - -import java.util.ArrayList; - -public class SearchTest { - - @ParameterizedTest - @CsvSource({ - "java", - "java tutorial", - "dev java" - }) - public void testResults(String query) throws Exception { - Assertions.assertFalse(new Search(query).getResults().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "java", - "how to program in java", - "java in android", - "java tutorial", - "learning java" - }) - public void testGetVideosResults(String query) throws Exception { - Assertions.assertFalse(new Search(query).getVideosResults().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "java", - "dev java" - }) - public void testGetShortsResults(String query) throws Exception { - Assertions.assertFalse(new Search(query).getShortsResults().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "java videos", - "java tutorial" - }) - public void testGetPlaylistsResults(String query) throws Exception { - Assertions.assertFalse(new Search(query).getPlaylistsResults().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "java" - }) - public void testGetChannelsResults(String query) throws Exception { - Assertions.assertFalse(new Search(query).getChannelsResults().isEmpty()); - } - - @ParameterizedTest - @CsvSource({ - "java", - }) - public void testGetCompletionSuggestions(String query) throws Exception { - Assertions.assertNotNull(new Search(query).getCompletionSuggestions()); - } - - @Test - public void testGenerateContinuation() throws Exception { - Search s = new Search("java"); - ArrayList result = s.getResults(); - s.generateContinuation(); - Assertions.assertTrue(s.getResults().size() > result.size()); - } - -} diff --git a/src/test/java/com/github/felipeucelli/javatube/StreamQueryTest.java b/src/test/java/com/github/felipeucelli/javatube/StreamQueryTest.java deleted file mode 100644 index 3cb6b3e..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/StreamQueryTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; - -import java.util.ArrayList; - -public class StreamQueryTest { - - static ArrayList streamTest = new ArrayList<>(); - static ArrayList streamDubbedTest = new ArrayList<>(); - - public static void setDubbedStreams() throws Exception { - String[] url = { - "https://www.youtube.com/watch?v=g_VxOIlg7q8", - "https://www.youtube.com/watch?v=WdXQabecaEs" - }; - for(String s : url){ - streamDubbedTest.add(new Youtube(s).streams()); - } - } - public static void setStreams() throws Exception { - String[] url = { - "https://www.youtube.com/watch?v=60ItHLz5WEA", - "https://www.youtube.com/watch?v=2lAe1cqCOXo", - "https://www.youtube.com/watch?v=J9Q1J5I7ac0" - }; - for(String s : url){ - streamTest.add(new Youtube(s).streams()); - } - } - - static ArrayList getStreams() throws Exception { - if(streamTest.isEmpty()){ - setStreams(); - } - return streamTest; - } - - static ArrayList getDubbedStreams() throws Exception { - if(streamDubbedTest.isEmpty()){ - setDubbedStreams(); - } - return streamDubbedTest; - } - - @ParameterizedTest - @MethodSource("getDubbedStreams") - public void testGetDefaultAudioTracks(StreamQuery streams) { - for(Stream s : streams.getDefaultAudioTracks().getAll()){ - Assertions.assertTrue(s.isDefaultAudioTrack()); - } - } - - @ParameterizedTest - @MethodSource("getDubbedStreams") - public void testGetExtraAudioTracks(StreamQuery streams) { - for(Stream s : streams.getExtraAudioTracks().getAll()){ - Assertions.assertFalse(s.isDefaultAudioTrack()); - } - } - - @ParameterizedTest - @MethodSource("getDubbedStreams") - public void TestGetExtraAudioTracksByName(StreamQuery streams) { - ArrayList yt = streams.getExtraAudioTracksByName("English").getAll(); - Assertions.assertFalse(yt.isEmpty()); - - } - - @ParameterizedTest - @MethodSource("getStreams") - public void TestGetProgressive(StreamQuery streams) { - for(Stream s : streams.getProgressive().getAll()){ - Assertions.assertTrue(s.isProgressive()); - } - } - - @ParameterizedTest - @MethodSource("getStreams") - public void TestGetAdaptive(StreamQuery streams) { - for(Stream s : streams.getAdaptive().getAll()){ - Assertions.assertTrue(s.isAdaptive()); - } - } - - @ParameterizedTest - @MethodSource("getStreams") - public void TestGetOnlyAudio(StreamQuery streams) { - Stream yt = streams.getOnlyAudio(); - Assertions.assertFalse(yt.includeVideoTrack()); - } - - @ParameterizedTest - @MethodSource("getStreams") - public void TestGetLowestResolution(StreamQuery streams) { - Stream yt = streams.getLowestResolution(); - Assertions.assertTrue(yt.includeVideoTrack() && yt.includeAudioTrack()); - } - - @ParameterizedTest - @MethodSource("getStreams") - public void TestGetHighestResolution(StreamQuery streams) { - Stream yt = streams.getHighestResolution(); - Assertions.assertTrue(yt.includeVideoTrack() && yt.includeAudioTrack()); - } - -} diff --git a/src/test/java/com/github/felipeucelli/javatube/YoutubeTest.java b/src/test/java/com/github/felipeucelli/javatube/YoutubeTest.java deleted file mode 100644 index 94ad7c3..0000000 --- a/src/test/java/com/github/felipeucelli/javatube/YoutubeTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.github.felipeucelli.javatube; - -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.params.provider.ValueSource; - - -public class YoutubeTest { - - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, https://www.youtube.com/watch?v=2lAe1cqCOXo", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, https://www.youtube.com/watch?v=WNeLUngb-Xg" - }) - public void testGetUrl(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Youtube(linkToTest).getUrl()); - - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, YouTube Rewind 2019: For the Record | #YouTubeRewind", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, Linkin Park - In The End (Mellen Gi & Tommee Profitt Remix)" - }) - public void testGetTitle(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Youtube(linkToTest).getTitle()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, YouTube", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, TrapMusicHDTV" - }) - public void testGetAuthor(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Youtube(linkToTest).getAuthor()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, https://i.ytimg.com/vi/2lAe1cqCOXo/maxresdefault.jpg", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, https://i.ytimg.com/vi/WNeLUngb-Xg/maxresdefault.jpg" - }) - public void testGetThumbnailUrl(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Youtube(linkToTest).getThumbnailUrl()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, 120854317", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, 120854317" - }) - public void testGetViews(String linkToTest, long ref) throws Exception { - Assertions.assertTrue(new Youtube(linkToTest).getViews() >= ref); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, 2019-12-05", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, 2018-10-09" - }) - public void testGetPublishDate(String linkToTest, String expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Youtube(linkToTest).getPublishDate()); - } - - @ParameterizedTest - @CsvSource({ - "https://www.youtube.com/watch?v=2lAe1cqCOXo, 337", - "https://www.youtube.com/watch?v=WNeLUngb-Xg, 219" - }) - public void testLength(String linkToTest, int expectedOutput) throws Exception { - Assertions.assertEquals(expectedOutput, new Youtube(linkToTest).length()); - } - - @ParameterizedTest - @ValueSource(strings = { - "https://www.youtube.com/watch?v=2lAe1cqCOXo", - "https://www.youtube.com/watch?v=WNeLUngb-Xg" - }) - public void testGetDescription(String linkToTest) throws Exception { - Assertions.assertNotNull(new Youtube(linkToTest).getDescription()); - } - - @ParameterizedTest - @ValueSource(strings = { - "https://www.youtube.com/watch?v=2lAe1cqCOXo", - "https://www.youtube.com/watch?v=WNeLUngb-Xg" - }) - public void testGetKeyword(String linkToTest) throws Exception { - Assertions.assertNotNull(new Youtube(linkToTest).getKeywords()); - } -}