From 9f73f21f75dbe06a9f859802eeeae66ea9be1564 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 10 Feb 2015 21:24:55 +0100 Subject: [PATCH] Use new comic loader, update HTML file and test --- .../comics/AbstruseGooseComicFilterTest.java | 14 +-- src/test/resources/comics/abstrusegoose.html | 102 --------------------- .../rhynodge/filters/comics/abstruse-goose.html | 102 +++++++++++++++++++++ 3 files changed, 106 insertions(+), 112 deletions(-) delete mode 100644 src/test/resources/comics/abstrusegoose.html create mode 100644 src/test/resources/net/pterodactylus/rhynodge/filters/comics/abstruse-goose.html 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 8ad16b0..931dd35 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java @@ -42,31 +42,25 @@ public class AbstruseGooseComicFilterTest { private final Document document; public AbstruseGooseComicFilterTest() throws IOException { - document = loadDocument("/comics/abstrusegoose.html", "http://abstrusegoose.com/"); - } - - private Document loadDocument(String resourceName, String baseUri) throws IOException { - InputStream inputStream = getClass().getResourceAsStream(resourceName); - Document document = Jsoup.parse(inputStream, "UTF-8", baseUri); - return document; + document = ComicLoader.loadDocument("abstruse-goose.html", "http://abstrusegoose.com/"); } @Test public void extractsComicTitleCorrectly() { Optional title = abstruseGooseComicFilter.extractTitle(document); - assertThat(title, is(of("Bizarro"))); + assertThat(title, is(of("The Sudokomic Game"))); } @Test public void extractComicImagesCorrectly() { List images = abstruseGooseComicFilter.extractImageUrls(document); - assertThat(images, contains("http://abstrusegoose.com/strips/bizero.png")); + assertThat(images, contains("http://abstrusegoose.com/strips/another_fun_game_is_comic_tac_toe.png")); } @Test public void extractImageCommentsCorrectly() { List comments = abstruseGooseComicFilter.extractImageComments(document); - assertThat(comments, contains("In the additive group of the integers, bizarro zero is... well... zero.")); + assertThat(comments, contains("This is the best I could do on short notice.")); } } diff --git a/src/test/resources/comics/abstrusegoose.html b/src/test/resources/comics/abstrusegoose.html deleted file mode 100644 index 7e06768..0000000 --- a/src/test/resources/comics/abstrusegoose.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - Abstruse Goose | Bizarro - - - - - - - - - -
- - - - - -
- - - - -
- - - -
-
-

«« First    « Previous    |   Random   |   Next »    Current »»

Bizarro


- bizero
-

«« First    « Previous    |   Random   |   Next »    Current »»

- - - - \ No newline at end of file diff --git a/src/test/resources/net/pterodactylus/rhynodge/filters/comics/abstruse-goose.html b/src/test/resources/net/pterodactylus/rhynodge/filters/comics/abstruse-goose.html new file mode 100644 index 0000000..df29b65 --- /dev/null +++ b/src/test/resources/net/pterodactylus/rhynodge/filters/comics/abstruse-goose.html @@ -0,0 +1,102 @@ + + + + + + Abstruse Goose | The Sudokomic Game + + + + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+

«« First    « Previous    |   Random   |   Next »    Current »»

The Sudokomic Game


+ another_fun_game_is_comic_tac_toe
+

«« First    « Previous    |   Random   |   Next »    Current »»

+ + + + \ No newline at end of file -- 2.7.4