--- /dev/null
+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;
+ }
+
+}
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;
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
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;
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
import java.io.IOException;
+import net.pterodactylus.rhynodge.filters.ResourceLoader;
+
import com.google.common.base.Optional;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
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
+++ /dev/null
-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;
- }
-
-}
import java.io.IOException;
+import net.pterodactylus.rhynodge.filters.ResourceLoader;
+
import com.google.common.base.Optional;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
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