From 45e0e2fa61e8aef4a3148f5b46f44297508b8228 Mon Sep 17 00:00:00 2001 From: soloturn Date: Tue, 13 Jun 2023 06:19:54 +0200 Subject: [PATCH] new URI instead of new URL in tests. --- .../ripper/rippers/DeviantartRipperTest.java | 26 ++++++++++--------- .../ripper/rippers/DribbbleRipperTest.java | 7 ++--- .../ripper/rippers/DuckmoviesRipperTest.java | 7 ++--- .../tst/ripper/rippers/EhentaiRipperTest.java | 10 ++++--- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java index 73982c9f..23dbe679 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DeviantartRipperTest.java @@ -1,6 +1,8 @@ package com.rarchives.ripme.tst.ripper.rippers; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -15,31 +17,31 @@ import org.junit.jupiter.api.Test; public class DeviantartRipperTest extends RippersTest { @Test @Disabled("Broken ripper") - public void testDeviantartAlbum() throws IOException { - DeviantartRipper ripper = new DeviantartRipper(new URL("https://www.deviantart.com/airgee/gallery/")); + public void testDeviantartAlbum() throws IOException, URISyntaxException { + DeviantartRipper ripper = new DeviantartRipper(new URI("https://www.deviantart.com/airgee/gallery/").toURL()); testRipper(ripper); } @Test @Disabled("Broken ripper") - public void testDeviantartNSFWAlbum() throws IOException { + public void testDeviantartNSFWAlbum() throws IOException, URISyntaxException { // NSFW gallery - DeviantartRipper ripper = new DeviantartRipper(new URL("https://www.deviantart.com/faterkcx/gallery/")); + DeviantartRipper ripper = new DeviantartRipper(new URI("https://www.deviantart.com/faterkcx/gallery/").toURL()); testRipper(ripper); } @Test @Disabled("Broken ripper") - public void testGetGID() throws IOException { - URL url = new URL("https://www.deviantart.com/airgee/gallery/"); + public void testGetGID() throws IOException, URISyntaxException { + URL url = new URI("https://www.deviantart.com/airgee/gallery/").toURL(); DeviantartRipper ripper = new DeviantartRipper(url); Assertions.assertEquals("airgee", ripper.getGID(url)); } @Test @Disabled("Broken ripper") - public void testGetGalleryIDAndUsername() throws IOException { - URL url = new URL("https://www.deviantart.com/airgee/gallery/"); + public void testGetGalleryIDAndUsername() throws IOException, URISyntaxException { + URL url = new URI("https://www.deviantart.com/airgee/gallery/").toURL(); DeviantartRipper ripper = new DeviantartRipper(url); Document doc = Http.url(url).get(); // Had to comment because of refactoring/style change @@ -49,11 +51,11 @@ public class DeviantartRipperTest extends RippersTest { @Test @Disabled("Broken ripper") - public void testSanitizeURL() throws IOException { + public void testSanitizeURL() throws IOException, URISyntaxException { List urls = new ArrayList(); - urls.add(new URL("https://www.deviantart.com/airgee/")); - urls.add(new URL("https://www.deviantart.com/airgee")); - urls.add(new URL("https://www.deviantart.com/airgee/gallery/")); + urls.add(new URI("https://www.deviantart.com/airgee/").toURL()); + urls.add(new URI("https://www.deviantart.com/airgee").toURL()); + urls.add(new URI("https://www.deviantart.com/airgee/gallery/").toURL()); for (URL url : urls) { DeviantartRipper ripper = new DeviantartRipper(url); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DribbbleRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DribbbleRipperTest.java index bd4321fc..4a6bf37b 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DribbbleRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DribbbleRipperTest.java @@ -1,7 +1,8 @@ package com.rarchives.ripme.tst.ripper.rippers; import java.io.IOException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import com.rarchives.ripme.ripper.rippers.DribbbleRipper; import org.junit.jupiter.api.Disabled; @@ -10,8 +11,8 @@ import org.junit.jupiter.api.Test; public class DribbbleRipperTest extends RippersTest { @Test @Disabled("test or ripper broken") - public void testDribbbleRip() throws IOException { - DribbbleRipper ripper = new DribbbleRipper(new URL("https://dribbble.com/typogriff")); + public void testDribbbleRip() throws IOException, URISyntaxException { + DribbbleRipper ripper = new DribbbleRipper(new URI("https://dribbble.com/typogriff").toURL()); testRipper(ripper); } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DuckmoviesRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DuckmoviesRipperTest.java index e4b17cb1..909ddb09 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DuckmoviesRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/DuckmoviesRipperTest.java @@ -6,14 +6,15 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.io.IOException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; public class DuckmoviesRipperTest extends RippersTest { @Test @Disabled("Broken ripper") - public void testRip() throws IOException { + public void testRip() throws IOException, URISyntaxException { DuckmoviesRipper ripper = new DuckmoviesRipper( - new URL("https://palapaja.com/spyfam-stepbro-gives-in-to-stepsis-asian-persuasion/")); + new URI("https://palapaja.com/spyfam-stepbro-gives-in-to-stepsis-asian-persuasion/").toURL()); testRipper(ripper); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/EhentaiRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/EhentaiRipperTest.java index 021e892f..31fee74e 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/EhentaiRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/EhentaiRipperTest.java @@ -1,6 +1,8 @@ package com.rarchives.ripme.tst.ripper.rippers; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.List; @@ -11,15 +13,15 @@ import org.junit.jupiter.api.Test; public class EhentaiRipperTest extends RippersTest { @Test - public void testEHentaiAlbum() throws IOException { - EHentaiRipper ripper = new EHentaiRipper(new URL("https://e-hentai.org/g/1144492/e823bdf9a5/")); + public void testEHentaiAlbum() throws IOException, URISyntaxException { + EHentaiRipper ripper = new EHentaiRipper(new URI("https://e-hentai.org/g/1144492/e823bdf9a5/").toURL()); testRipper(ripper); } // Test the tag black listing @Test - public void testTagBlackList() throws IOException { - URL url = new URL("https://e-hentai.org/g/1228503/1a2f455f96/"); + public void testTagBlackList() throws IOException, URISyntaxException { + URL url = new URI("https://e-hentai.org/g/1228503/1a2f455f96/").toURL(); EHentaiRipper ripper = new EHentaiRipper(url); List tagsOnPage = ripper.getTags(ripper.getFirstPage()); // Test multiple blacklisted tags