Move and update test HTML for “heldentage.”
[rhynodge.git] / src / test / java / net / pterodactylus / rhynodge / filters / comics / HeldentageFilterTest.java
1 package net.pterodactylus.rhynodge.filters.comics;
2
3 import static com.google.common.base.Optional.absent;
4 import static java.util.Arrays.asList;
5 import static org.hamcrest.MatcherAssert.assertThat;
6 import static org.hamcrest.Matchers.is;
7 import static org.jsoup.Jsoup.parse;
8
9 import java.io.IOException;
10 import java.io.InputStream;
11 import java.util.Collections;
12
13 import org.jsoup.nodes.Document;
14 import org.junit.Test;
15
16 /**
17  * Unit test for {@link HeldentageFilter}.
18  *
19  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
20  */
21 public class HeldentageFilterTest {
22
23         private final HeldentageFilter heldentageFilter = new HeldentageFilter();
24         private final Document document;
25
26         public HeldentageFilterTest() throws IOException {
27                 document = loadDocument("heldentage.html", "http://www.der-flix.de/");
28         }
29
30         private Document loadDocument(String resourceName, String baseUri) throws IOException {
31                 InputStream inputStream = getClass().getResourceAsStream(resourceName);
32                 Document document = parse(inputStream, "UTF-8", baseUri);
33                 return document;
34         }
35
36         @Test
37         public void comicDoesNotHaveATitle() {
38                 assertThat(heldentageFilter.extractTitle(document), is(absent()));
39         }
40
41         @Test
42         public void comicUrlCanBeFound() {
43                 assertThat(heldentageFilter.extractImageUrls(document), is(asList("/images/heldentage/Tag_916.jpg")));
44         }
45
46         @Test
47         public void comicDoesNotHaveImageComments() {
48                 assertThat(heldentageFilter.extractImageComments(document), is(Collections.<String>emptyList()));
49         }
50
51 }