diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java index 8fa2cfc0..f7918aad 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BooruRipperTest.java @@ -2,6 +2,8 @@ package com.rarchives.ripme.tst.ripper.rippers; import java.io.IOException; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import com.rarchives.ripme.ripper.rippers.BooruRipper; import org.junit.jupiter.api.Assertions; @@ -10,14 +12,49 @@ import org.junit.jupiter.api.Test; public class BooruRipperTest extends RippersTest { @Test public void testRip() throws IOException { - BooruRipper ripper = new BooruRipper(new URL("http://xbooru.com/index.php?page=post&s=list&tags=furry")); - testRipper(ripper); + List passURLs = new ArrayList<>(); + passURLs.add(new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry")); + passURLs.add(new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears")); + + for (URL url : passURLs) { + BooruRipper ripper = new BooruRipper(url); + testRipper(ripper); + } } @Test public void testGetGID() throws IOException { - URL url = new URL("http://xbooru.com/index.php?page=post&s=list&tags=furry"); - BooruRipper ripper = new BooruRipper(url); - Assertions.assertEquals("furry", ripper.getGID(url)); + URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"); + URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"); + + BooruRipper xbooruRipper = new BooruRipper(xbooruUrl); + BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl); + + Assertions.assertEquals("furry", xbooruRipper.getGID(xbooruUrl)); + Assertions.assertEquals("animal_ears", gelbooruRipper.getGID(gelbooruUrl)); + } + + @Test + public void testGetDomain() throws IOException { + URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"); + URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"); + + BooruRipper xbooruRipper = new BooruRipper(xbooruUrl); + BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl); + + Assertions.assertEquals("xbooru.com", xbooruRipper.getDomain()); + Assertions.assertEquals("gelbooru.com", gelbooruRipper.getDomain()); + } + + @Test + public void testGetHost() throws IOException { + URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"); + URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"); + + BooruRipper xbooruRipper = new BooruRipper(xbooruUrl); + BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl); + + Assertions.assertEquals("xbooru", xbooruRipper.getHost()); + Assertions.assertEquals("gelbooru", gelbooruRipper.getHost()); } } \ No newline at end of file