Rename comic loader to resource loader
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Feb 2015 19:39:15 +0000 (20:39 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Feb 2015 19:39:57 +0000 (20:39 +0100)
src/test/java/net/pterodactylus/rhynodge/filters/ResourceLoader.java [new file with mode: 0644]
src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java
src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java
src/test/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.java
src/test/java/net/pterodactylus/rhynodge/filters/comics/ComicLoader.java [deleted file]
src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java

diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/ResourceLoader.java b/src/test/java/net/pterodactylus/rhynodge/filters/ResourceLoader.java
new file mode 100644 (file)
index 0000000..53a239a
--- /dev/null
@@ -0,0 +1,22 @@
+package net.pterodactylus.rhynodge.filters;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+
+/**
+ * Loads a resource from the classpath and parses it as HTML.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class ResourceLoader {
+
+       public static Document loadDocument(String resourceName, String baseUri) throws IOException {
+               InputStream inputStream = ResourceLoader.class.getResourceAsStream(resourceName);
+               Document document = Jsoup.parse(inputStream, "UTF-8", baseUri);
+               return document;
+       }
+
+}
index 931dd35..2232096 100644 (file)
@@ -23,11 +23,11 @@ import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.is;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.List;
 
+import net.pterodactylus.rhynodge.filters.ResourceLoader;
+
 import com.google.common.base.Optional;
-import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.junit.Test;
 
@@ -42,7 +42,7 @@ public class AbstruseGooseComicFilterTest {
        private final Document document;
 
        public AbstruseGooseComicFilterTest() throws IOException {
-               document = ComicLoader.loadDocument("abstruse-goose.html", "http://abstrusegoose.com/");
+               document = ResourceLoader.loadDocument("abstruse-goose.html", "http://abstrusegoose.com/");
        }
 
        @Test
index 077342c..acc40be 100644 (file)
@@ -1,12 +1,12 @@
 package net.pterodactylus.rhynodge.filters.comics;
 
 import java.io.IOException;
-import java.io.InputStream;
+
+import net.pterodactylus.rhynodge.filters.ResourceLoader;
 
 import com.google.common.base.Optional;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
-import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.junit.Test;
 
@@ -19,7 +19,7 @@ public class BusinessCatComicFilterTest {
        private final Document document;
 
        public BusinessCatComicFilterTest() throws IOException {
-               document = ComicLoader.loadDocument("business-cat.html", "http://www.businesscat.happyjar.com//");
+               document = ResourceLoader.loadDocument("business-cat.html", "http://www.businesscat.happyjar.com//");
        }
 
        @Test
index d511ced..679c67f 100644 (file)
@@ -2,6 +2,8 @@ package net.pterodactylus.rhynodge.filters.comics;
 
 import java.io.IOException;
 
+import net.pterodactylus.rhynodge.filters.ResourceLoader;
+
 import com.google.common.base.Optional;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
@@ -19,7 +21,7 @@ public class ChiefOBrienAtWorkComicFilterTest {
        private final Document document;
 
        public ChiefOBrienAtWorkComicFilterTest() throws IOException {
-               document = ComicLoader.loadDocument("chief-obrien-at-work.html", "http://chiefobrienatwork.com/");
+               document = ResourceLoader.loadDocument("chief-obrien-at-work.html", "http://chiefobrienatwork.com/");
        }
 
        @Test
diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/ComicLoader.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/ComicLoader.java
deleted file mode 100644 (file)
index c6a4cec..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.pterodactylus.rhynodge.filters.comics;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.jsoup.Jsoup;
-import org.jsoup.nodes.Document;
-
-/**
- * Loads a resource from the classpath and parses it as HTML.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
- */
-public class ComicLoader {
-
-       static Document loadDocument(String resourceName, String baseUri) throws IOException {
-               InputStream inputStream = ComicLoader.class.getResourceAsStream(resourceName);
-               Document document = Jsoup.parse(inputStream, "UTF-8", baseUri);
-               return document;
-       }
-
-}
index 2d7a118..3522d35 100644 (file)
@@ -2,6 +2,8 @@ package net.pterodactylus.rhynodge.filters.comics;
 
 import java.io.IOException;
 
+import net.pterodactylus.rhynodge.filters.ResourceLoader;
+
 import com.google.common.base.Optional;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
@@ -19,7 +21,7 @@ public class CyanideAndHappinessComicFilterTest {
        private final Document document;
 
        public CyanideAndHappinessComicFilterTest() throws IOException {
-               document = ComicLoader.loadDocument("cyanide-and-happiness.html", "http://www.explosm.net/comics/new/");
+               document = ResourceLoader.loadDocument("cyanide-and-happiness.html", "http://www.explosm.net/comics/new/");
        }
 
        @Test