From: David ‘Bombe’ Roden Date: Wed, 11 Feb 2015 19:39:15 +0000 (+0100) Subject: Rename comic loader to resource loader X-Git-Tag: v2~204 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=562369ca4c3d7f46ef0ac383bd55382916952263;p=rhynodge.git Rename comic loader to resource loader --- 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 index 0000000..53a239a --- /dev/null +++ b/src/test/java/net/pterodactylus/rhynodge/filters/ResourceLoader.java @@ -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 David ‘Bombe’ Roden + */ +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; + } + +} diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java index 931dd35..2232096 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java @@ -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 diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java index 077342c..acc40be 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java @@ -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 diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.java index d511ced..679c67f 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.java @@ -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 index c6a4cec..0000000 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/ComicLoader.java +++ /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 David ‘Bombe’ Roden - */ -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; - } - -} diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java index 2d7a118..3522d35 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java @@ -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